[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: function name
- From: Wim Couwenberg <debosberg@...>
- Date: Sat, 6 Mar 2004 14:57:48 -0800 (PST)
> local Name = "MultThree"
> local function Main(x,y,z) do
> return x*y*z
> end
>
> return main
>
> ...After which point Name would be available as an
> upvalue of the function
> (OK, I'd have to double check that Lua doesn't
> optimize this particular
> upvalue away given that it wasn't used in the
> function).
It is not so much a question of optimisation; the
local "Name" is simply not referenced in the function
"Main" so no upvalue is created for it. A closure
does *not* keep entire stack frames alive: it only
creates upvalues for locals that it actually
references.
--
Wim
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you?re looking for faster
http://search.yahoo.com