lua-users home
lua-l archive

Re: regexp in lua

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


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

AltStyle によって変換されたページ (->オリジナル) /