samedi 18 juillet 2015

Lua pattern matching with minus sign between spaces

.

Hi folks!

I have a variable "message" which I get from Userinput. For example:

!word number word-word---word

or

!word wordword-word

Currently I create a table and fill it with every single word/number (without digits like -)

--input table
it = {}
--put input in table
for _input in string.gmatch((message), '%w+') do
    it[#it+1] = { input=_input }
end

First of all I cant get words with minus between them to my table. Also I cant check if it[2].input is not empty. This is an example how I check the table:

--TEST START
if it[1].input == 'test' then
    --do something
end
--TEST END

I've tried this without any working result.

Aucun commentaire:

Enregistrer un commentaire