MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaL_argerror

Function luaL_argerror

Source/Misc/lua/src/lua.c:10255–10270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10253
10254
10255LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
10256lua_Debug ar;
10257if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
10258return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
10259lua_getinfo(L, "n", &ar);
10260if (strcmp(ar.namewhat, "method") == 0) {
10261narg--; /* do not count `self' */
10262if (narg == 0) /* error is in the self argument itself? */
10263return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
10264ar.name, extramsg);
10265}
10266if (ar.name == NULL)
10267ar.name = "?";
10268return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
10269narg, ar.name, extramsg);
10270}
10271
10272
10273LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {

Calls 3

lua_getstackFunction · 0.85
luaL_errorFunction · 0.85
lua_getinfoFunction · 0.85

Tested by

no test coverage detected