lua-users home
lua-l archive

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


> 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