lua-users home
lua-l archive

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



Thanks, but no thanks.

In the sample it works okay, but my code is 4900+ lines, and most are regular 'local's. Only a few of these cases, were I need to predeclare them.

I guess there's no better way - just wanted to check. :)

-ak


1.9.2004 kello 04:19, Fabio Mascarenhas kirjoitti:

 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