lua-users home
lua-l archive

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


This is a continuation of my luaL_checkudata/luaL_testudata
optimization ideas. How about a new API, lua_metatabletopointer (or
lua_getmetatablepointer?), acting as if lua_getmetatable followed by
lua_topointer, but without touching the Lua stack? This would enable
faster "are we really called with 'our' userdata?" checks and reduce
userdata metamethod call overhead (checks would trivially extend to,
say, a list of metatables known to a function).

There's a small implementation of it inside lua_getmetatable already:)

Best regards,