Posted 14 September 2015 - 01:02 PM
Already Solved please lock this thread
Edited on 14 September 2015 - 11:36 AM
local words = {}
for word in read():gmatch( "%S+" ) do
words[ #words + 1 ] = word
end
if words[ 1 ] == "/pm" then
--#words[ 2 ] is the user, words[ 3 ] and higher are parts of the message
end
thank you it works. :)/>read returns a string. There are string manipulation functions, such as string.match. To split into words, do this:local words = {} for word in read():gmatch( "%S+" ) do words[ #words + 1 ] = word end if words[ 1 ] == "/pm" then --#words[ 2 ] is the user, words[ 3 ] and higher are parts of the message end
Maybe you should add that to this: http://www.computercraft.info/forums2/index.php?/topic/14531-read-this-post-before-asking-questions/ because this is something I've seen multiple times now, and this is the reason people ask the same question over and over again.Please do not destroy your question when it has been answered. That prevents people who are doing the right thing and using the search feature from being able to find and learn from your question and the answer to it.