dimanche 22 février 2015

Lua: split string into words unless quoted

So I have the following code to split a string between whitespaces:



text = "I am 'the text'"
for string in text:gmatch("%S+") do
print(string)
end


The result:



I
am
'the
text'


But I need to do this:



I
am
the text --[[yep, without the quotes]]


How can I do this?


Aucun commentaire:

Enregistrer un commentaire