MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaL_typeerror

Function luaL_typeerror

extlibs/lua/src/lauxlib.c:193–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192
193int luaL_typeerror (lua_State *L, int arg, const char *tname) {
194 const char *msg;
195 const char *typearg; /* name for the type of the actual argument */
196 if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING)
197 typearg = lua_tostring(L, -1); /* use the given type name */
198 else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA)
199 typearg = "light userdata"; /* special name for messages */
200 else
201 typearg = luaL_typename(L, arg); /* standard name */
202 msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg);
203 return luaL_argerror(L, arg, msg);
204}
205
206
207static void tag_error (lua_State *L, int arg, int tag) {

Callers 1

tag_errorFunction · 0.85

Calls 4

luaL_getmetafieldFunction · 0.85
lua_typeFunction · 0.85
lua_pushfstringFunction · 0.85
luaL_argerrorFunction · 0.85

Tested by

no test coverage detected