[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [CFD] Local functions for Lua 4.1
- From: "Nick Trout" <nick@...>
- Date: Thu, 22 Nov 2001 16:11:42 -0000
> The reason I suggest this change is that the current behavior is not
> what you would normally expect. Namely:
>
> function foo()
> ...
> function bar()
> ...
> bar()
> ...
> end
> ...
> bar()
> ...
> end
Could you not use the new "global" keyword to stop this? (I think this has
been added)
eg.
function foo()
global
function bar()
bar()
end
bar()
end
This will cause an error as bar() is not defined at global level, so you must
do
function foo()
global
local bar
function bar()
bar()
end
bar()
end
or
function foo()
global
local bar = function bar()
bar()
end
bar()
end
This would stop your problem but whether you want to add: local function() end
is a different matter.
Nick