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?

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

PrintTable( exp )



1 = your
2 = text

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