lua-users home
lua-l archive

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


I'm more or less new to Lua so forgive me if this a simple question. 
I have been integrating Lua into a C++ object system  which uses a 
object factory to create the objects that are stored in DLLs on a 
windows system.  The factory uses the FuBi system described by Scott 
Bilas to regster all the object and functions at runtime allowing me 
to drop a new object into a directory and it is immediately available 
in Lua. My problem is this.  When I create a new object, something 
like the following:

object_1 = MyObject;

Where 'MyObject' has been registered by the FuBi system by 
registering it's factory creator with lua as a usertag that is 
actually a diplatching function that passes parameters and executes 
the function stored in the function map ( much like luna ).

Most objects are going to have a lifetime that outlives the lua state 
and the system already incorporates its own gc paradigm. I would like 
to be able to make the internal name of the object ( the one stored 
outside of Lua) the same as the variable name used in Lua. So in the 
case above the internal name of my object would be 'object_1'. I am 
trying not to do something like:

object_1 = MyObject("object_1") 

or something similar like

MyObject(object_1);

especially if there is a cleaner way to do it using the API. I have 
tried to use tagmethods without any success. Is this something that 
can't be done? Again forgive me if this is a foolish question, I'm 
still pretty new to Lua development; and I am still getting my feet 
wet..

--Scott