Lua 5.5.0 Release (#2119)

* Lua 5.5 beta

* lua 5.5.0 release
This commit is contained in:
云风
2025-12-23 10:19:09 +08:00
committed by GitHub
parent 28e8087029
commit 406f3a7437
66 changed files with 6125 additions and 3857 deletions

View File

@@ -16,6 +16,7 @@
#include "lauxlib.h"
#include "lualib.h"
#include "llimits.h"
static lua_State *getco (lua_State *L) {
@@ -153,8 +154,13 @@ static int luaB_costatus (lua_State *L) {
}
static lua_State *getoptco (lua_State *L) {
return (lua_isnone(L, 1) ? L : getco(L));
}
static int luaB_yieldable (lua_State *L) {
lua_State *co = lua_isnone(L, 1) ? L : getco(L);
lua_State *co = getoptco(L);
lua_pushboolean(L, lua_isyieldable(co));
return 1;
}
@@ -168,7 +174,7 @@ static int luaB_corunning (lua_State *L) {
static int luaB_close (lua_State *L) {
lua_State *co = getco(L);
lua_State *co = getoptco(L);
int status = auxstatus(L, co);
switch (status) {
case COS_DEAD: case COS_YIELD: {
@@ -183,8 +189,17 @@ static int luaB_close (lua_State *L) {
return 2;
}
}
default: /* normal or running coroutine */
case COS_NORM:
return luaL_error(L, "cannot close a %s coroutine", statname[status]);
case COS_RUN:
lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */
if (lua_tothread(L, -1) == co)
return luaL_error(L, "cannot close main thread");
lua_closethread(co, L); /* close itself */
/* previous call does not return *//* FALLTHROUGH */
default:
lua_assert(0);
return 0;
}
}