lua-users home
lua-l archive

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

> I want to store a pointer to a table in a c++ class, then 
> push the table onto the lua stack, and call a lua method that 
> accepts the table as the first param.
> I don't seem  to be able to store a table as a void* and then 
> push it as a table via the lua c api ...

You'll have to store the table in the registry and look it up when you need

Alternativately, a C++ enhanced distribution of Lua (
allows tables (and other Lua types) to be stored in regular C++ objects
(called LuaObject) and maintained outside the stack or registry.  That is:

class MyClass
    LuaObject m_obj;

m_obj = luaState->GetGlobal("SomeTable");