[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Binding C++ objects with LUA
- From: Ignacio Burgueño <ignacio@...>
- Date: Thu, 5 Sep 2002 19:54:42 -0300
Hello. I'm new to the list.
I'd like to ask a question about binding C++ with LUA. I'm currently using
LUNA.
I have two objects: an object of class A, which has an instance of a class
Eval, which wraps LUA, and another class, A_Proxy, which is the one that
gets exposed to LUA. The A_Proxy holds a pointer to the A object.
The A object is created first, then, at some point, some LUA code is
executed, which creates the A_Proxy and calls methods. Then A is deleted,
closing Lua (by means of lua_close).
In order to hook those two objects, I put a pointer to A in the stack and
call setglobal. When I create the A_Proxy in Lua, I pass the global to its
constructor.
The second time I do this, the call to setglobal fails with "invalid tag for
a userdata (6)".
What am I doing wrong? Is there an easier way to link these two objects?
Greetings!
Ignacio Burgueño