[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua way to do this code
- From: Mariusz Gliwiński <alienballance@...>
- Date: Thu, 18 Oct 2012 17:03:37 +0200
2012-10-18 17:40, Hisham wrote:
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
Thank you both for answers.
I have no idea about lua/luajit internals but i don't use `:` because i
imagine that interpreter has to additionally follow metatable on every call.
Another reason is consistency. In my code i chose to not embed function
references in short-living objects if i don't need abstraction for that.
Instead of that, i am trying to do runtime ducktyping. I have no idea if
it's gonna be good way for solving things, but so far, this style of
coding works for my project.
So, it's my little experiment, and i find lua good language for
experimenting.
Best regards,
Mariusz Gliwiński