[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: local-ity of undef parameter
- From: spir <denis.spir@...>
- Date: Tue, 8 Dec 2009 13:46:19 +0100
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/