lua-users home
lua-l archive

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


this gives me a memory exception!
how you get it from script after doing that?
a = Account()
?
it crashs when I try

On Mon, Nov 12, 2012 at 9:28 AM, Ignacio Burgueño <iburgueno@gmail.com> wrote:
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 garbage
  lua_close(L);
  return 0;
}

There's really not much more needed to push already created objects to Lua.