lua-users home
lua-l archive

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


Asko Kauppi wrote:

Is there a simple "better way" to this?


You can make it more simmetrical (and slightly more verbose), declaring both at the same time, and also use explicit assignments, I think this would reduce the chance for errors:

local func1, func2

func1 = function ()
  ...
  func2()
  ...
end

func2 = function ()
  ...
  func1()
  ...
end

Using explicit assigment solves the "look like a global" problem, as all the globals in your code are probably being declared in the usual way. :-)

--
Fabio Mascarenhas