lua-users home
lua-l archive

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


>>>>> "Milan" == Milan Obuch <lua-l@dino.sk> writes:

 Milan> Currently I am creating metatable with some method like this:

 Milan> luaL_newmetatable(L,TABLE_ID);
 Milan> luaL_openlib(L,NULL,table_instance_methods,0);
 Milan> lua_pop(L,1);

 Milan> I can then associate this metatable with some variable (I use
 Milan> light userdata) and this could be used for simple OOP-like
 Milan> programming.

 Milan> I just could not achive the same effect with luaL_newlibtable
 Milan> and luaL_setfuncs...

    luaL_newmetatable(L, TABLE_ID);
    luaL_setfuncs(L, table_instance_methods, 0);
    lua_pop(L, 1);

-- 
Andrew.