Reading parts of text

I’m working on some simple chat commands to learn more Lua. Is there a way I can read separate parts of a string, separated by, say, spaces. Meaning:

!command name reason
!slay Humble rdm

I can read the command using string.sub, but the problem comes with the name. Is there a way to search for a certain character in the string library or GLua overall?

[lua]
local exp = string.Explode( " ", ‘your text’ )

PrintTable( exp )

[/lua]

output



1 = your
2 = text


So, if I get it correctly, ‘your’ would be exp[1] and ‘text’ would be exp[2] ?

Exactly.