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