[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: regexp in lua
- From: Romulo Bahiense <romulo@...>
- Date: Tue, 02 Aug 2005 18:09:29 -0300
It's also cheaper to use new local variables each time than
to reuse them.
(...)
local _,_,a,b = string.find(...)
if a then ... end
local _,_,c = string.find(...)
if c then ... end
I didn't know that it's better to redeclare them instead of just
reusing. I wonder if it is valid for chunks too:
while <condition> do
local _,_,a,b = string.find(...)
end
local _,a,b
while <condition> do
_,_,a,b = string.find(...)
end
According to you, the first is better than the second, right?
Don't be ashamed of those '_' variables. It's a Lua idiom,
no more, no less.
I don't. I also use it very often, but I had to show him possible
alternatives :)
... so that's how select() was born.
I also remember that discussion ;)
Thanks for the tips,
Me