MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaL_argerror

Function luaL_argerror

freebsd/contrib/openzfs/module/lua/lauxlib.c:147–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145*/
146
147LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
148 lua_Debug ar;
149 if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
150 return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
151 lua_getinfo(L, "n", &ar);
152 if (strcmp(ar.namewhat, "method") == 0) {
153 narg--; /* do not count `self' */
154 if (narg == 0) /* error is in the self argument itself? */
155 return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
156 ar.name, extramsg);
157 }
158 if (ar.name == NULL)
159 ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
160 return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
161 narg, ar.name, extramsg);
162}
163
164
165static int typeerror (lua_State *L, int narg, const char *tname) {

Callers 5

str_formatFunction · 0.70
typeerrorFunction · 0.70
luaL_checkoptionFunction · 0.70
luaL_checkanyFunction · 0.70
zcp_argerrorFunction · 0.50

Calls 5

strcmpFunction · 0.85
pushglobalfuncnameFunction · 0.85
lua_getstackFunction · 0.70
luaL_errorFunction · 0.70
lua_getinfoFunction · 0.70

Tested by

no test coverage detected