[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: what's wrong?
- From: Mike Pall <mikelu-0509@...>
- Date: Sun, 4 Sep 2005 15:02:01 +0200
Hi,
Stukov wrote:
> My program use a lot of modules , and has hundreds
> global variables declared with tolua ( not fast thing too ).
Maybe it's a good idea to make the dependencies between
your modules explicit by letting them 'require' each other.
If you do it the following way you get a local/upvalue that
lives on even after using module():
local A = require "A"
local B = require "B"
module(...)
function f3()
A.f1()
B.f2()
end
As far as tolua is concerned ... I've not used it, but can't
you collect related C functions into tables (aka modules)?
Something like this:
local mywindowlib = require "mywindowlib"
module(...)
mywindowlib.MsgBox(str)
Or if you use some functions very often, you could even do:
local mywindowlib = require "mywindowlib"
local MsgBox = mywindowlib.MsgBox
module(...)
MsgBox(str)
Bye,
Mike