Question

nanepiwo
Member
 
Posts: 23
Joined: Mon Jan 05, 2015 20:13
GitHub: nanepiwo
IRC: nanepiwo or nane
In-game: nanepiwo

Question

by nanepiwo » Wed Jan 07, 2015 22:51

If i have two params from a chat command, how can i output them separately?
 

User avatar
rubenwardy
Moderator
 
Posts: 5803
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Question

by rubenwardy » Wed Jan 07, 2015 23:04

You can use: local arr = param:split(" ")

/foo one two

To get one, arr[1]
To get two, arr[2]

You could use string:match instead if one of the params uses spaces, but I can never remember how to use it.
 

nanepiwo
Member
 
Posts: 23
Joined: Mon Jan 05, 2015 20:13
GitHub: nanepiwo
IRC: nanepiwo or nane
In-game: nanepiwo

Re: Question

by nanepiwo » Wed Jan 07, 2015 23:10

Okay, thanks!

I'll look into string:match
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest