MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_checkudata

Function luaL_checkudata

third-party/lua-5.1.5/src/lauxlib.c:124–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
125 void *p = lua_touserdata(L, ud);
126 if (p != NULL) { /* value is a userdata? */
127 if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
128 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
129 if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
130 lua_pop(L, 2); /* remove both metatables */
131 return p;
132 }
133 }
134 }
135 luaL_typerror(L, ud, tname); /* else error */
136 return NULL; /* to avoid warnings */
137}
138
139
140LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {

Callers 1

gctmFunction · 0.70

Calls 5

luaL_typerrorFunction · 0.85
lua_touserdataFunction · 0.70
lua_getmetatableFunction · 0.70
lua_getfieldFunction · 0.70
lua_rawequalFunction · 0.70

Tested by

no test coverage detected