lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Oct 17, 2012 at 9:37 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>       for k,v in string.gmatch(str,"([xyz])=(%d+)") do
>         ret[k] = tonumber(v)
>       end

And since we're talking style and the original poster had an issue
with verbosity, I think it's nice to remind him of this possibility as
well:

for k,v in str:gmatch("([xyz])=(%d+)") do
   ret[k] = tonumber(v)
end

I essentially never use "string." in my code anymore :)

-- Hisham