diff options
author | Li Jin <dragon-fly@qq.com> | 2022-08-25 11:24:10 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-08-26 10:10:19 +0800 |
commit | df85ad2e7f975026ca1e6bd84b26fff81c8d99c8 (patch) | |
tree | 2b9300041c291382b15da3c354de3640a1498c1b /src/3rdParty/lua/lapi.c | |
parent | 2f497477c984e576e9ba7e8f6cb92ee9f794e56b (diff) | |
download | yuescript-df85ad2e7f975026ca1e6bd84b26fff81c8d99c8.tar.gz yuescript-df85ad2e7f975026ca1e6bd84b26fff81c8d99c8.tar.bz2 yuescript-df85ad2e7f975026ca1e6bd84b26fff81c8d99c8.zip |
update to Lua 5.4.5.
Diffstat (limited to 'src/3rdParty/lua/lapi.c')
-rw-r--r-- | src/3rdParty/lua/lapi.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/3rdParty/lua/lapi.c b/src/3rdParty/lua/lapi.c index 5ee6579..5833c7b 100644 --- a/src/3rdParty/lua/lapi.c +++ b/src/3rdParty/lua/lapi.c | |||
@@ -114,13 +114,8 @@ LUA_API int lua_checkstack (lua_State *L, int n) { | |||
114 | api_check(L, n >= 0, "negative 'n'"); | 114 | api_check(L, n >= 0, "negative 'n'"); |
115 | if (L->stack_last - L->top > n) /* stack large enough? */ | 115 | if (L->stack_last - L->top > n) /* stack large enough? */ |
116 | res = 1; /* yes; check is OK */ | 116 | res = 1; /* yes; check is OK */ |
117 | else { /* no; need to grow stack */ | 117 | else /* need to grow stack */ |
118 | int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; | 118 | res = luaD_growstack(L, n, 0); |
119 | if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ | ||
120 | res = 0; /* no */ | ||
121 | else /* try to grow stack */ | ||
122 | res = luaD_growstack(L, n, 0); | ||
123 | } | ||
124 | if (res && ci->top < L->top + n) | 119 | if (res && ci->top < L->top + n) |
125 | ci->top = L->top + n; /* adjust frame top */ | 120 | ci->top = L->top + n; /* adjust frame top */ |
126 | lua_unlock(L); | 121 | lua_unlock(L); |
@@ -202,7 +197,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
202 | newtop = L->top + diff; | 197 | newtop = L->top + diff; |
203 | if (diff < 0 && L->tbclist >= newtop) { | 198 | if (diff < 0 && L->tbclist >= newtop) { |
204 | lua_assert(hastocloseCfunc(ci->nresults)); | 199 | lua_assert(hastocloseCfunc(ci->nresults)); |
205 | luaF_close(L, newtop, CLOSEKTOP, 0); | 200 | newtop = luaF_close(L, newtop, CLOSEKTOP, 0); |
206 | } | 201 | } |
207 | L->top = newtop; /* correct top only after closing any upvalue */ | 202 | L->top = newtop; /* correct top only after closing any upvalue */ |
208 | lua_unlock(L); | 203 | lua_unlock(L); |
@@ -215,8 +210,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) { | |||
215 | level = index2stack(L, idx); | 210 | level = index2stack(L, idx); |
216 | api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist == level, | 211 | api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist == level, |
217 | "no variable to close at given level"); | 212 | "no variable to close at given level"); |
218 | luaF_close(L, level, CLOSEKTOP, 0); | 213 | level = luaF_close(L, level, CLOSEKTOP, 0); |
219 | level = index2stack(L, idx); /* stack may be moved */ | ||
220 | setnilvalue(s2v(level)); | 214 | setnilvalue(s2v(level)); |
221 | lua_unlock(L); | 215 | lua_unlock(L); |
222 | } | 216 | } |