MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / luaL_testudata

Function luaL_testudata

modules/engine/lua/src/build.skr_lua.cpp:303–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void *luaL_testudata (lua_State *L, int i, const char *tname) {
304 void *p = lua_touserdata(L, i);
305 luaL_checkstack(L, 2, "not enough stack slots");
306 if (p == NULL || !lua_getmetatable(L, i))
307 return NULL;
308 else {
309 int res = 0;
310 luaL_getmetatable(L, tname);
311 res = lua_rawequal(L, -1, -2);
312 lua_pop(L, 2);
313 if (!res)
314 p = NULL;
315 }
316 return p;
317}
318
319void luaL_setmetatable (lua_State *L, const char *tname) {
320 luaL_checkstack(L, 1, "not enough stack slots");

Callers 1

bind_skr_resource_handleFunction · 0.70

Calls 4

lua_touserdataFunction · 0.50
luaL_checkstackFunction · 0.50
lua_getmetatableFunction · 0.50
lua_rawequalFunction · 0.50

Tested by

no test coverage detected