|
After registering the class, you only need to push the pointer of a new instance. I modified the example a bit (didn't try to compile)int main(int argc, char *argv[]){lua_State *L = lua_open();luaL_openlibs(L);Lunar<Account>::Register(L);Account* account = new Account;Lunar<Account>::push(account);
lua_gc(L, LUA_GCCOLLECT, 0); // collected garbagelua_close(L);return 0;}There's really not much more needed to push already created objects to Lua.