lua-users home
lua-l archive

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


Am 21.08.2015 um 04:18 schröbte Sean Conner:


1) Allow unique metatables for lightuserdata, that also respect __gc.

lightuserdata is a value type. `__gc` doesn't work well with value types ...

    lua_pushlightuserdata( L, 0x1234 );
    luaL_getmetatable( L, "metatablewithgc" );
    lua_setmetatable( L, -2 );
    lua_pushvalue( L, -1 ); /* duplicate lightuserdata */
    lua_pop( L, 2 );
    /* should the __gc method really run twice now? */


   -spc (I can't let Soni have all the fun here ... [5])

Philipp