lua-users home
lua-l archive

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


Sorry looking again at your posted code
@@ -244,6 +244,8 @@ namespace luabind { namespace detail
    {
        object_rep* result = static_cast<object_rep*>(lua_
touserdata(L,
index));

+        return result;
+
        if (!result || !lua_getmetatable(L, index))
            return 0;

OOLua is meant to replace usage of Lua C API calls in client code, yet it still enables you to use the C API. The metatable check you have was present in earlier releases yet profiling showed that it was a costly operation and now it is only preformed if the type is not the requested type, this does rely on the index actually being a Lua_ud. The code you posted only checks that the userdata has a metatable not that it is an actual object_rep from what I see.

Just as you have a method to turn this off locally I may introduce a define to turn it on if a user so requires, in a future release.

Liam