✓ Accepted answer
gmatch kinda sorta works like pairs, in that you need to use in when you iterate through it.
for word in string.gmatch("Hello2!,- Lua user", "[^%s]+") do
print(word)
end
gmatch will pass back to word the snipped bits of a string (The first arguement) that's specified by the pattern (The second arguement)
In this case, the pattern is, %s which is all spaces, [^%s] which means anything that is NOT a white space, [^%s]+ which means anything that is NOT a white space, until another match is found.
For long term success read up on the library here h e r e ranOutOfLetters and here
2 comments
Is there a reason as to why you need to do this.
I believe it is to change who is being killed.