[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua way to do this code
- From: Hisham <h@...>
- Date: Thu, 18 Oct 2012 12:40:24 -0300
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