| 192 | } |
| 193 | |
| 194 | [[noreturn]] int argerror(lua_State *L, int narg, const char *extramsg) { |
| 195 | lua_Debug ar; |
| 196 | if (!lua_getstack(L, 0, &ar)) |
| 197 | error(L, "bad argument #%d (%s)", narg, extramsg); |
| 198 | lua_getinfo(L, "n", &ar); |
| 199 | if (strcmp(ar.namewhat, "method") == 0 && --narg == 0) |
| 200 | error(L, "calling '%s' on bad self (%s)", ar.name, extramsg); |
| 201 | if (!ar.name) ar.name = "?"; |
| 202 | error(L, "bad argument #%d to '%s' (%s)", |
| 203 | narg, ar.name, extramsg); |
| 204 | } |
| 205 | |
| 206 | [[noreturn]] int typerror(lua_State *L, int narg, const char *tname) { |
| 207 | const char *msg = lua_pushfstring(L, "%s expected, got %s", |
no test coverage detected