From 39e38e94bdaa5a1d3540762a6c07dd457e567719 Mon Sep 17 00:00:00 2001 From: MCJack123 Date: Mon, 1 Jan 2024 03:20:38 -0500 Subject: [PATCH] Fixed some errors on iOS --- src/lapi.c | 4 +++- src/ldo.c | 3 ++- src/llex.c | 2 +- src/lmathlib.c | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lapi.c b/src/lapi.c index 6b7fc32..d87b090 100644 --- a/src/lapi.c +++ b/src/lapi.c @@ -7,6 +7,7 @@ #include #include +#include #define lapi_c #define LUA_CORE @@ -370,7 +371,8 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) { lua_Unsigned res; lua_Number num = nvalue(o); //lua_number2unsigned(res, num); - res = (lua_Unsigned)floor(num); + if (num < 0) res = -(lua_Unsigned)fabs(floor(num)); + else res = (lua_Unsigned)floor(num); if (isnum) *isnum = 1; return res; } diff --git a/src/ldo.c b/src/ldo.c index 23b0cf9..042d836 100644 --- a/src/ldo.c +++ b/src/ldo.c @@ -438,7 +438,7 @@ static void finishCcall (lua_State *L) { ci->callstatus &= ~CIST_HOOKED; switch (ci->hook) { case LUA_HOOKCALL: - case LUA_HOOKTAILCALL: + case LUA_HOOKTAILCALL: { /* call function since luaD_precall yielded before calling */ int n; lua_CFunction f; @@ -449,6 +449,7 @@ static void finishCcall (lua_State *L) { lua_lock(L); luaD_poscall(L, L->top - n); break; + } case LUA_HOOKRET: /* retry return with hooks disabled */ L->allowhook = 0; diff --git a/src/llex.c b/src/llex.c index 9950d73..bce1a70 100644 --- a/src/llex.c +++ b/src/llex.c @@ -43,7 +43,7 @@ static const char *const luaX_tokens [] = { "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while", "..", "...", "==", ">=", "<=", "~=", "::", "", - "", "", "" + "", "", "", "goto" }; diff --git a/src/lmathlib.c b/src/lmathlib.c index 4b106c8..c31152d 100644 --- a/src/lmathlib.c +++ b/src/lmathlib.c @@ -8,6 +8,7 @@ #include #include #include +#include #define lmathlib_c #define LUA_LIB