lua-users home
lua-l archive

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


Hello,

output = function(thing, level)
   level = level or 1
   -- or
   if not level then level = 1
   ...
end

Is here 'level' local in the case it was not defined inthe calling expression? Or should I write:
   local level = level or 1
   -- or
   if not level then local level = 1
to ensure its "local-ity"?

The point imo is, if level is undef, then there is no reason for an assignment to implicitely make it local -- except if the compiler deduces this quality from the fact that the name happens to be the same as the one of a parameter. Or do I miss the point?

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/