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

Function luaL_argerror

depends/lua/src/lauxlib.c:164–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162*/
163
164LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) {
165 lua_Debug ar;
166 if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
167 return luaL_error(L, "bad argument #%d (%s)", arg, extramsg);
168 lua_getinfo(L, "n", &ar);
169 if (strcmp(ar.namewhat, "method") == 0) {
170 arg--; /* do not count 'self' */
171 if (arg == 0) /* error is in the self argument itself? */
172 return luaL_error(L, "calling '%s' on bad self (%s)",
173 ar.name, extramsg);
174 }
175 if (ar.name == NULL)
176 ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
177 return luaL_error(L, "bad argument #%d to '%s' (%s)",
178 arg, ar.name, extramsg);
179}
180
181
182static int typeerror (lua_State *L, int arg, const char *tname) {

Callers 15

check_valid_ptr_indexFunction · 0.85
signal_typeid_errorFunction · 0.85
lua_dfhack_colorFunction · 0.85
dfhack_curryFunction · 0.85
dfhack_event_newindexFunction · 0.85
get_site_dataFunction · 0.85
get_world_dataFunction · 0.85
decode_matinfoFunction · 0.85
dfhack_matinfo_matchesFunction · 0.85
check_pen_nativeFunction · 0.85

Calls 4

lua_getstackFunction · 0.85
luaL_errorFunction · 0.85
lua_getinfoFunction · 0.85
pushglobalfuncnameFunction · 0.85

Tested by

no test coverage detected