MCPcopy Create free account
hub / github.com/DFHack/dfhack / typeerror

Function typeerror

depends/lua/src/lauxlib.c:182–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181
182static int typeerror (lua_State *L, int arg, const char *tname) {
183 const char *msg;
184 const char *typearg; /* name for the type of the actual argument */
185 if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING)
186 typearg = lua_tostring(L, -1); /* use the given type name */
187 else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA)
188 typearg = "light userdata"; /* special name for messages */
189 else
190 typearg = luaL_typename(L, arg); /* standard name */
191 msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg);
192 return luaL_argerror(L, arg, msg);
193}
194
195
196static void tag_error (lua_State *L, int arg, int tag) {

Callers 2

tag_errorFunction · 0.85
luaL_checkudataFunction · 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