[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re: Antwort: global keyword instead of local
- From: Carlos Cassino <cassino@...>
- Date: Mon, 28 Aug 2000 15:56:22 -0300 (EST)
> In Python you can pass the function object as a default parameter to
> work around this problem. However, I have no idea how to work around
> this in Lua. Upvalues don't work, because the variable is created
> after the function definition has been evaluated. Just for the fun of
> it, ideas anyone?
As you said, it's not straightforward, but you can do it with upvalues:
function f()
local g = {}
g.f = function()
%g.f()
end
end
-- Cassino