| 1236 | |
| 1237 | |
| 1238 | LUA_API int lua_error (lua_State *L) { |
| 1239 | TValue *errobj; |
| 1240 | lua_lock(L); |
| 1241 | errobj = s2v(L->top.p - 1); |
| 1242 | api_checknelems(L, 1); |
| 1243 | /* error object is the memory error message? */ |
| 1244 | if (ttisshrstring(errobj) && eqshrstr(tsvalue(errobj), G(L)->memerrmsg)) |
| 1245 | luaM_error(L); /* raise a memory error */ |
| 1246 | else |
| 1247 | luaG_errormsg(L); /* raise a regular error */ |
| 1248 | /* code unreachable; will unlock when control actually leaves the kernel */ |
| 1249 | return 0; /* to avoid warnings */ |
| 1250 | } |
| 1251 | |
| 1252 | |
| 1253 | LUA_API int lua_next (lua_State *L, int idx) { |
no test coverage detected