public static int lua_ref(lua_State L, bool lockit) { if (lockit) return luaL_ref(L, LUA_REGISTRYINDEX); lua_pushstring(L, "unlocked references are obsolete"); lua_error(L); return 0; }