Question

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

Question

by nanepiwo » Post

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

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

Re: Question

by rubenwardy » Post

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 » Post

Okay, thanks!

I'll look into string:match

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest