New type 'TStatus' for thread status/error codes

This commit is contained in:
Roberto Ierusalimschy
2025-01-30 11:41:39 -03:00
parent f7439112a5
commit d1e677c52b
10 changed files with 56 additions and 46 deletions

10
lapi.c
View File

@@ -1070,7 +1070,7 @@ static void f_call (lua_State *L, void *ud) {
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
lua_KContext ctx, lua_KFunction k) {
struct CallS c;
int status;
TStatus status;
ptrdiff_t func;
lua_lock(L);
api_check(L, k == NULL || !isLua(L->ci),
@@ -1107,14 +1107,14 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
}
adjustresults(L, nresults);
lua_unlock(L);
return status;
return APIstatus(status);
}
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
const char *chunkname, const char *mode) {
ZIO z;
int status;
TStatus status;
lua_lock(L);
if (!chunkname) chunkname = "?";
luaZ_init(L, &z, reader, data);
@@ -1131,7 +1131,7 @@ LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
}
}
lua_unlock(L);
return status;
return APIstatus(status);
}
@@ -1154,7 +1154,7 @@ LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) {
LUA_API int lua_status (lua_State *L) {
return L->status;
return APIstatus(L->status);
}