lua-users home
lua-l archive

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



On 2-Aug-05, at 4:09 PM, Romulo Bahiense wrote:

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


Regardless of efficiency, it is always better to make variables as local as possible.

However, it is also more efficient.