lua-users home
lua-l archive

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

> 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


Do you Yahoo!?
Yahoo! Search - Find what you?re looking for faster