MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaL_checkudata

Function luaL_checkudata

other_src/lua/src/lauxlib.cpp: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_testudata (lua_State *L, int ud, const char *tname) { /*BZ*/

Callers 5

gctmFunction · 0.70
WorldScript.cppFile · 0.50
meshGCFunction · 0.50
CheckHTTPMethod · 0.50
CheckServerPingMethod · 0.50

Calls 5

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

Tested by

no test coverage detected