diff -Nr lua-5.5.0/Makefile lua-5.5.1/Makefile 39c39 < PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris --- > PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris 49c49 < R= $V.0 --- > R= $V.1 diff -Nr lua-5.5.0/README lua-5.5.1/README 2c2 < This is Lua 5.5.0, released on 15 Dec 2025. --- > This is Lua 5.5.1, released on 15 Jul 2026. diff -Nr lua-5.5.0/doc/contents.html lua-5.5.1/doc/contents.html 35c35 < Copyright © 2020–2025 Lua.org, PUC-Rio. --- > Copyright © 2020–2026 Lua.org, PUC-Rio. 708c708 < Thu Dec 4 17:32:26 UTC 2025 --- > Mon Jul 13 21:19:58 UTC 2026 711c711 < Last change: revised for Lua 5.5.0 --- > Last change: revised for Lua 5.5.1 diff -Nr lua-5.5.0/doc/manual.html lua-5.5.1/doc/manual.html 22c22 < Copyright © 2020–2025 Lua.org, PUC-Rio. --- > Copyright © 2020–2026 Lua.org, PUC-Rio. 3266c3266,3280 < Several functions in the API return pointers (const char*) --- > Several functions in the API have parameters > that are pointers to C strings (const char*). > Some of these parameters have an associated length (size_t). > Unless stated otherwise, > when there is an associated length, > the string can contain embedded zeros; > moreover, the pointer can be NULL if the length is zero. > When there is no associated length, > the pointer must point to a zero-terminated string. > In any case, the string contents should remain unchanged > until the function returns. > > >

> Several functions in the API also return pointers (const char*) 4817,4818c4831,4838 < (The user values can be set and read with the functions < lua_setiuservalue and lua_getiuservalue.) --- > > >

> The user values can be set and read with the functions > lua_setiuservalue and lua_getiuservalue. > The block of memory is suitably aligned for any ISO C object. > (See macro LUAI_MAXALIGN in file luaconf.h for other > alignment requirements.) 4872,4873c4892,4895 < See function next for the caveats of modifying < the table during its traversal. --- > > >

> See function next for more details about the traversal. 5543c5565 < then you call lua_resume, --- > Then you call lua_resume, 5793c5815 < [-0, +1, –] --- > [-0, +(0|1), –] 6244c6266 < with the n results removed and --- > with all the results (nresults) removed and 6345c6367 < The length of the string source. --- > the length of the string source. 6531c6553 < fills in the fields source, short_src, --- > fills in the fields source, srclen, short_src, 6762c6784,6786 < Parameters ar and n are as in the function lua_getlocal. --- > Parameters ar and n are as in the function lua_getlocal, > except that ar cannot be NULL, > as lua_setlocal only operates on activation records. 8657,8658c8681 < See function next for the caveats of modifying < the table during its traversal. --- > See function next for more details about the traversal. 11683a11707,11709 > > >

11692a11719,11720 > It is good practice to always require this library explicitly > before using it. 12308a12337,12341 > > >

> The compilation option LUA_COMPAT_GLOBAL (see luaconf.h) > makes global a regular word. 12438c12471 < global attnamelist | --- > global attnamelist [‘=’ explist] | 12502c12535 < Mon Dec 15 21:02:05 UTC 2025 --- > Wed Jul 15 20:19:12 UTC 2026 12505c12538 < Last change: revised for Lua 5.5.0 --- > Last change: revised for Lua 5.5.1 diff -Nr lua-5.5.0/doc/readme.html lua-5.5.1/doc/readme.html 112c112 < the top-level directory, which is named lua-5.5.0. --- > the top-level directory, which is named lua-5.5.1. 265a266 >

  • named vararg tables 299c300 < Copyright © 1994–2025 Lua.org, PUC-Rio. --- > Copyright © 1994–2026 Lua.org, PUC-Rio. 326c327 < Wed Dec 10 11:37:23 UTC 2025 --- > Mon Jul 13 21:20:24 UTC 2026 329c330 < Last change: revised for Lua 5.5.0 --- > Last change: revised for Lua 5.5.1 diff -Nr lua-5.5.0/src/Makefile lua-5.5.1/src/Makefile 33c33 < PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris --- > PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris 125a126,128 > linux-readline: > $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline" > 127c130 < $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline" --- > $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" diff -Nr lua-5.5.0/src/lapi.c lua-5.5.1/src/lapi.c 190c190 < setnilvalue(s2v(L->top.p++)); /* clear new slots */ --- > setnilvalue2s(L->top.p++); /* clear new slots */ 213c213 < setnilvalue(s2v(level)); --- > setnilvalue2s(level); 369c369 < LUA_API unsigned (lua_numbertocstring) (lua_State *L, int idx, char *buff) { --- > LUA_API unsigned lua_numbertocstring (lua_State *L, int idx, char *buff) { 516c516 < setnilvalue(s2v(L->top.p)); --- > setnilvalue2s(L->top.p); 573c573 < setnilvalue(s2v(L->top.p)); --- > setnilvalue2s(L->top.p); 746c746 < setnilvalue(s2v(L->top.p)); --- > setnilvalue2s(L->top.p); 839c839 < setnilvalue(s2v(L->top.p)); --- > setnilvalue2s(L->top.p); 1124a1125 > luaC_checkGC(L); 1203a1205 > l_mem newdebt; 1207,1208c1209,1214 < n = g->GCdebt; /* force to run one basic step */ < luaE_setdebt(g, g->GCdebt - n); --- > newdebt = 0; /* force to run one basic step */ > else if (g->GCdebt >= n - MAX_LMEM) /* no overflow? */ > newdebt = g->GCdebt - n; > else /* overflow */ > newdebt = -MAX_LMEM; /* set debt to miminum value */ > luaE_setdebt(g, newdebt); diff -Nr lua-5.5.0/src/lauxlib.c lua-5.5.1/src/lauxlib.c 515a516,529 > /* > ** Get/create metatable (MT) for boxes > */ > static void getBoxMT (lua_State *L) { > const char *BOXMT = "_UBOX*"; /* key for the metatable */ > if (luaL_getmetatable(L, BOXMT) == LUA_TNIL) { /* MT not created yet? */ > luaL_newlibtable(L, boxmt); /* create it */ > luaL_setfuncs(L, boxmt, 0); /* initialize it */ > lua_copy(L, -1, -2); /* change stack from nil,MT to MT,MT */ > lua_setfield(L, LUA_REGISTRYINDEX, BOXMT); /* store MT in the registry */ > } > } > > 520,521c534 < if (luaL_newmetatable(L, "_UBOX*")) /* creating metatable? */ < luaL_setfuncs(L, boxmt, 0); /* set its metamethods */ --- > getBoxMT(L); 877c890 < return luaL_loadbuffer(L, s, strlen(s), s); --- > return luaL_loadbufferx(L, s, strlen(s), s, "t"); diff -Nr lua-5.5.0/src/lauxlib.h lua-5.5.1/src/lauxlib.h 84,85c84,85 < LUALIB_API void *luaL_alloc (void *ud, void *ptr, size_t osize, < size_t nsize); --- > LUALIB_API void *(luaL_alloc) (void *ud, void *ptr, size_t osize, > size_t nsize); 106c106 < LUALIB_API unsigned luaL_makeseed (lua_State *L); --- > LUALIB_API unsigned (luaL_makeseed) (lua_State *L); diff -Nr lua-5.5.0/src/lbaselib.c lua-5.5.1/src/lbaselib.c 343,344c343,345 < const char *mode = luaL_optstring(L, idx, "bt"); < if (strchr(mode, 'B') != NULL) /* Lua code cannot use fixed buffers */ --- > const char *mode = luaL_optstring(L, idx, NULL); > if (mode != NULL && strchr(mode, 'B') != NULL) { > /* Lua code cannot use fixed buffers */ 345a347 > } 367,378c369 < ** reserved slot, above all arguments, to hold a copy of the returned < ** string to avoid it being collected while parsed. 'load' has four < ** optional arguments (chunk, source name, mode, and environment). < */ < #define RESERVEDSLOT 5 < < < /* < ** Reader for generic 'load' function: 'lua_load' uses the < ** stack for internal stuff, so the reader cannot change the < ** stack top. Instead, it keeps its resulting string in a < ** reserved slot inside the stack. --- > ** Reader for generic 'load' function. 381c372 < (void)(ud); /* not used */ --- > int *firstcall = cast(int *, ud); 382a374,377 > if (*firstcall) > *firstcall = 0; > else > lua_pop(L, 1); /* remove previous result */ 386d380 < lua_pop(L, 1); /* pop result */ 392,393c386 < lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ < return lua_tolstring(L, RESERVEDSLOT, size); --- > return lua_tolstring(L, -1, size); 407a401 > int firstcall = 1; /* userdata for generic_reader */ 410,411c404 < lua_settop(L, RESERVEDSLOT); /* create reserved slot */ < status = lua_load(L, generic_reader, NULL, chunkname, mode); --- > status = lua_load(L, generic_reader, &firstcall, chunkname, mode); 428c421 < if (l_unlikely(luaL_loadfile(L, fname) != LUA_OK)) --- > if (l_unlikely(luaL_loadfilex(L, fname, "bt") != LUA_OK)) diff -Nr lua-5.5.0/src/lcode.c lua-5.5.1/src/lcode.c 666,667c666,667 < TValue k, v; < setnilvalue(&v); --- > lua_State *L = fs->ls->L; > TValue k; 669,670c669,670 < sethvalue(fs->ls->L, &k, fs->kcache); < return k2proto(fs, &k, &v); --- > sethvalue(L, &k, fs->kcache); > return k2proto(fs, &k, &G(L)->nilvalue); 830c830 < e->u.info = temp; /* (can't do a direct assignment; values overlap) */ --- > e->u.info = temp; /* (avoid a direct assignment; values overlap) */ 1368c1368 < t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */ --- > t->u.ind.t = temp; /* (avoid a direct assignment; values overlap) */ 1376c1376 < t->u.ind.t = vreg; /* (avoid a direct assignment; values may overlap) */ --- > t->u.ind.t = vreg; /* (avoid a direct assignment; values may overlap?) */ 1381c1381,1382 < t->u.ind.t = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info); --- > lu_byte temp = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info); > t->u.ind.t = temp; /* (avoid a direct assignment; values may overlap?) */ 1936,1937d1936 < /* avoid "not used" warnings when assert is off (for 'onelua.c') */ < (void)luaP_isOT; (void)luaP_isIT; diff -Nr lua-5.5.0/src/ldblib.c lua-5.5.1/src/ldblib.c 430c430 < if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || --- > if (luaL_loadbufferx(L, buffer, strlen(buffer), "=(debug command)", "t") || diff -Nr lua-5.5.0/src/ldebug.c lua-5.5.1/src/ldebug.c 294c294 < setnilvalue(s2v(L->top.p)); --- > setnilvalue2s(L->top.p); 583c583 < case OP_GETTABLE: { --- > case OP_GETTABLE: case OP_GETVARG: { diff -Nr lua-5.5.0/src/ldo.c lua-5.5.1/src/ldo.c 224,226c224,226 < ** Check whether stack has enough space to run a simple function (such < ** as a finalizer): At least BASIC_STACK_SIZE in the Lua stack and < ** 2 slots in the C stack. --- > ** Check whether stacks have enough space to run a simple function (such > ** as a finalizer): At least BASIC_STACK_SIZE in the Lua stack, two > ** available CallInfos, and two "slots" in the C stack. 229,230c229,238 < return ((stacksize(L) < MAXSTACK - BASIC_STACK_SIZE) && < (getCcalls(L) < LUAI_MAXCCALLS - 2)); --- > if (getCcalls(L) >= LUAI_MAXCCALLS - 2) > return 0; /* not enough C-stack slots */ > if (L->ci->next == NULL && luaE_extendCI(L, 0) == NULL) > return 0; /* unable to allocate first ci */ > if (L->ci->next->next == NULL && luaE_extendCI(L, 0) == NULL) > return 0; /* unable to allocate second ci */ > if (L->stack_last.p - L->top.p >= BASIC_STACK_SIZE) > return 1; /* enough (BASIC_STACK_SIZE) free slots in the Lua stack */ > else /* try to grow stack to a size with enough free slots */ > return luaD_growstack(L, BASIC_STACK_SIZE, 0); 344c352 < setnilvalue(s2v(newstack + i)); /* erase new segment */ --- > setnilvalue2s(newstack + i); /* erase new segment */ 425,430d432 < < void luaD_inctop (lua_State *L) { < L->top.p++; < luaD_checkstack(L, 1); < } < 549c551 < setnilvalue(s2v(res + i)); --- > setnilvalue2s(res + i); 569c571 < setnilvalue(s2v(res)); /* adjust with nil */ --- > setnilvalue2s(res); /* adjust with nil */ 619c621 < #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L)) --- > #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L, 1)) 689c691 < setnilvalue(s2v(func + narg1)); /* complete missing arguments */ --- > setnilvalue2s(func + narg1); /* complete missing arguments */ 736c738 < setnilvalue(s2v(L->top.p++)); /* complete missing arguments */ --- > setnilvalue2s(L->top.p++); /* complete missing arguments */ 1122a1125,1128 > /* > ** Before the first call to the reader function, Lua reserves a slot > ** with a table for anchoring stuff. > */ 1127c1133,1139 < int c = zgetc(p->z); /* read first character */ --- > int c; > Table *anchor; > ptrdiff_t otop = savestack(L, L->top.p); /* original top */ > luaD_checkstack(L, 2); > anchor = luaH_new(L); /* create the anchor table */ > sethvalue2s(L, L->top.p++, anchor); /* anchor the anchor table */ > c = zgetc(p->z); /* read first character */ 1134c1146 < cl = luaU_undump(L, p->z, p->name, fixed); --- > cl = luaU_undump(L, p->z, anchor, p->name, fixed); 1138c1150 < cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); --- > cl = luaY_parser(L, p->z, anchor, &p->buff, &p->dyd, p->name, c); 1139a1152,1153 > L->top.p = restorestack(L, otop); /* restore stack */ > setclLvalue2s(L, L->top.p++, cl); /* push closure */ 1141a1156,1169 > } > > > /* > ** Anchor an object in a table in the stack. First, anchor the object > ** temporarily in the stack, as luaH_set may call an emergency GC. > ** Then, add it in the table with itself as its key. > */ > void luaD_anchorobj (lua_State *L, Table *anchor, GCObject *obj) { > setgcovalue(L, s2v(L->top.p++), obj); /* temporary anchor in the stack */ > luaH_set(L, anchor, s2v(L->top.p - 1), s2v(L->top.p - 1)); > /* Because this is a new key, luaH_set will call the GC barrier, so > we don't need to call the barrier again here */ > L->top.p--; diff -Nr lua-5.5.0/src/ldo.h lua-5.5.1/src/ldo.h 91d90 < LUAI_FUNC void luaD_inctop (lua_State *L); 92a92 > LUAI_FUNC void luaD_anchorobj (lua_State *L, Table *anchor, GCObject *obj); diff -Nr lua-5.5.0/src/lgc.c lua-5.5.1/src/lgc.c 712c712 < setnilvalue(s2v(o)); /* clear dead stack slice */ --- > setnilvalue2s(o); /* clear dead stack slice */ 1296c1296 < if (!g->gcemergency && luaD_checkminstack(L)) --- > if (g->tobefnz != NULL && !g->gcemergency && luaD_checkminstack(L)) 1675c1675 < else { /* no more finalizers or emergency mode or no enough stack --- > else { /* no more finalizers or emergency mode or not enough stack diff -Nr lua-5.5.0/src/llex.c lua-5.5.1/src/llex.c 191c191 < #if defined(LUA_COMPAT_GLOBAL) --- > #if LUA_COMPAT_GLOBAL diff -Nr lua-5.5.0/src/llimits.h lua-5.5.1/src/llimits.h 237c237 < #define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) --- > #define luai_numidiv(L,a,b) l_floor(luai_numdiv(L,a,b)) 242c242 < #define luai_numdiv(L,a,b) ((a)/(b)) --- > #define luai_numdiv(L,a,b) ((void)L, (a)/(b)) 270,273c270,273 < #define luai_numadd(L,a,b) ((a)+(b)) < #define luai_numsub(L,a,b) ((a)-(b)) < #define luai_nummul(L,a,b) ((a)*(b)) < #define luai_numunm(L,a) (-(a)) --- > #define luai_numadd(L,a,b) ((void)L, (a)+(b)) > #define luai_numsub(L,a,b) ((void)L, (a)-(b)) > #define luai_nummul(L,a,b) ((void)L, (a)*(b)) > #define luai_numunm(L,a) ((void)L, -(a)) diff -Nr lua-5.5.0/src/loadlib.c lua-5.5.1/src/loadlib.c 544c544 < return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); --- > return checkload(L, (luaL_loadfilex(L, filename, "bt") == LUA_OK), filename); diff -Nr lua-5.5.0/src/lobject.h lua-5.5.1/src/lobject.h 211c211,212 < #define setnilvalue(obj) settt_(obj, LUA_VNIL) --- > #define setnilvalue(obj) settt_(obj, LUA_VNIL) > #define setnilvalue2s(stk) setnilvalue(s2v(stk)) diff -Nr lua-5.5.0/src/lopcodes.c lua-5.5.1/src/lopcodes.c 107c107 < ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */ --- > ,opmode(0, 0, 0, 0, 0, iABC) /* OP_VARARGPREP */ 112,124c112 < < /* < ** Check whether instruction sets top for next instruction, that is, < ** it results in multiple values. < */ < int luaP_isOT (Instruction i) { < OpCode op = GET_OPCODE(i); < switch (op) { < case OP_TAILCALL: return 1; < default: < return testOTMode(op) && GETARG_C(i) == 0; < } < } --- > #define testITMode(m) (luaP_opmodes[m] & (1 << 5)) 128,129c116,118 < ** Check whether instruction uses top from previous instruction, that is, < ** it accepts multiple results. --- > ** Check whether instruction uses top. That happens for OP_VARARGPREP > ** and for instructions that use multiple values set by the previous > ** instruction. 135c124,126 < return testITMode(GET_OPCODE(i)) && GETARG_vB(i) == 0; --- > return GETARG_vB(i) == 0; > case OP_VARARGPREP: > return 1; diff -Nr lua-5.5.0/src/lopcodes.h lua-5.5.1/src/lopcodes.h 420,421c420,421 < ** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0) < ** bit 6: instruction sets 'L->top' for next instruction (when C == 0) --- > ** bit 5: used by 'luaP_isIT' > ** bit 6: used by 'luaP_isOT' 430,431d429 < #define testITMode(m) (luaP_opmodes[m] & (1 << 5)) < #define testOTMode(m) (luaP_opmodes[m] & (1 << 6)) 435c433,440 < LUAI_FUNC int luaP_isOT (Instruction i); --- > /* Check whether instruction sets top for next instruction, that is, > ** it results in multiple values. Used only for tests. > */ > #define luaP_isOT(i) \ > (GET_OPCODE(i) == OP_TAILCALL || \ > ((luaP_opmodes[GET_OPCODE(i)] & (1 << 6)) && GETARG_C(i) == 0)) > > diff -Nr lua-5.5.0/src/lparser.c lua-5.5.1/src/lparser.c 824,825c824 < sethvalue2s(L, L->top.p, fs->kcache); /* anchor it */ < luaD_inctop(L); --- > luaD_anchorobj(L, ls->h, obj2gco(fs->kcache)); /* anchor it */ 833a833 > TValue temp; 845a846,848 > /* remove kcache table from scanner table ("weigh" its anchor) */ > sethvalue(L, &temp, fs->kcache); /* key to be set to nil */ > luaH_set(L, ls->h, &temp, &G(L)->nilvalue); 847d849 < L->top.p--; /* pop kcache table */ 1166a1169 > return; /* to avoid warnings */ 2114c2117 < #if defined(LUA_COMPAT_GLOBAL) --- > #if LUA_COMPAT_GLOBAL 2168c2171 < LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, --- > LClosure *luaY_parser (lua_State *L, ZIO *z, Table *anchor, Mbuffer *buff, 2172,2177c2175,2178 < LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ < setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */ < luaD_inctop(L); < lexstate.h = luaH_new(L); /* create table for scanner */ < sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */ < luaD_inctop(L); --- > LClosure *cl; > lexstate.h = anchor; /* table for scanner */ > cl = luaF_newLclosure(L, 1); /* create main closure */ > luaD_anchorobj(L, anchor, obj2gco(cl)); /* anchor it in scanner table */ 2190,2191c2191 < L->top.p--; /* remove scanner's table */ < return cl; /* closure is on the stack, too */ --- > return cl; diff -Nr lua-5.5.0/src/lparser.h lua-5.5.1/src/lparser.h 192,193c192,194 < LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, < Dyndata *dyd, const char *name, int firstchar); --- > LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Table *anchor, > Mbuffer *buff, Dyndata *dyd, > const char *name, int firstchar); diff -Nr lua-5.5.0/src/lstate.c lua-5.5.1/src/lstate.c 71c71 < CallInfo *luaE_extendCI (lua_State *L) { --- > CallInfo *luaE_extendCI (lua_State *L, int err) { 73,76c73,79 < lua_assert(L->ci->next == NULL); < ci = luaM_new(L, CallInfo); < lua_assert(L->ci->next == NULL); < L->ci->next = ci; --- > ci = luaM_reallocvector(L, NULL, 0, 1, CallInfo); > if (l_unlikely(ci == NULL)) { /* allocation failed? */ > if (err) > luaM_error(L); /* raise the error */ > return NULL; /* else only report it */ > } > ci->next = L->ci->next; 78c81,83 < ci->next = NULL; --- > L->ci->next = ci; > if (ci->next) > ci->next->previous = ci; 149c154 < setnilvalue(s2v(ci->func.p)); /* 'function' entry for basic 'ci' */ --- > setnilvalue2s(ci->func.p); /* 'function' entry for basic 'ci' */ 164c169 < setnilvalue(s2v(L1->stack.p + i)); /* erase new stack */ --- > setnilvalue2s(L1->stack.p + i); /* erase new stack */ diff -Nr lua-5.5.0/src/lstate.h lua-5.5.1/src/lstate.h 441c441 < LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); --- > LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L, int err); diff -Nr lua-5.5.0/src/lstrlib.c lua-5.5.1/src/lstrlib.c 144,145c144,145 < if (n <= 0) < lua_pushliteral(L, ""); --- > if (n <= 0 || (len | lsep) == 0) > lua_pushliteral(L, ""); /* no repetitions or both strings empty */ 759a760,762 > /* > ** Prepare state for matches. These fields are not affected by each match. > */ 763d765 < ms->matchdepth = MAXCCALLS; 769a772,775 > /* > ** (Re)prepare state for a match, setting fields that change during > ** each match. > */ 770a777 > ms->matchdepth = MAXCCALLS; 772d778 < lua_assert(ms->matchdepth == MAXCCALLS); 971c977 < changed = add_value(&ms, &b, src, e, tr) | changed; --- > changed = add_value(&ms, &b, src, e, tr) || changed; 1729c1735 < luaL_argcheck(L, totalsize <= LUA_MAXINTEGER - size, --- > luaL_argcheck(L, totalsize <= MAX_SIZE - size, diff -Nr lua-5.5.0/src/ltable.c lua-5.5.1/src/ltable.c 654,657c654,656 < ** Exchange the hash part of 't1' and 't2'. (In 'flags', only the < ** dummy bit must be exchanged: The 'isrealasize' is not related < ** to the hash part, and the metamethod bits do not change during < ** a resize, so the "real" table can keep their values.) --- > ** Exchange the hash part of 't1' and 't2'. (In 'flags', only the dummy > ** bit must be exchanged: The metamethod bits do not change during a > ** resize, so the "real" table can keep their values.) 1158a1158 > const TValue *actk = key; /* actual key to insert */ 1164,1166c1164,1166 < if (luaV_flttointeger(f, &k, F2Ieq)) { < setivalue(&aux, k); /* key is equal to an integer */ < key = &aux; /* insert it as an integer */ --- > if (luaV_flttointeger(f, &k, F2Ieq)) { /* is key equal to an integer? */ > setivalue(&aux, k); > actk = &aux; /* use the integer as the key */ 1179c1179 < luaH_newkey(L, t, key, value); --- > luaH_newkey(L, t, actk, value); diff -Nr lua-5.5.0/src/ltablib.c lua-5.5.1/src/ltablib.c 45c45 < ** has a metatable with the required metamethods) --- > ** has a metatable with the required metamethods). 48c48,49 < if (lua_type(L, arg) != LUA_TTABLE) { /* is it not a table? */ --- > int tp = lua_type(L, arg); > if (tp != LUA_TTABLE) { /* is it not a table? */ 53c54,55 < (!(what & TAB_L) || checkfield(L, "__len", ++n))) { --- > (!(what & TAB_L) || /* strings don't need '__len' to have a length */ > tp == LUA_TSTRING || checkfield(L, "__len", ++n))) { 206a209 > lua_Integer len = aux_getn(L, 1, TAB_R); 208c211 < lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); --- > lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, len); diff -Nr lua-5.5.0/src/ltm.c lua-5.5.1/src/ltm.c 265c265 < setnilvalue(s2v(ci->func.p + i)); /* erase original parameter (for GC) */ --- > setnilvalue2s(ci->func.p + i); /* erase original parameter (for GC) */ 286c286 < setnilvalue(s2v(ci->func.p + nfixparams + 1)); --- > setnilvalue2s(ci->func.p + nfixparams + 1); 310c310 < setnilvalue(s2v(ra)); /* else produce nil */ --- > setnilvalue2s(ra); /* else produce nil */ 358c358 < setnilvalue(s2v(where + i)); --- > setnilvalue2s(where + i); 362c362 < setnilvalue(s2v(where + i)); --- > setnilvalue2s(where + i); diff -Nr lua-5.5.0/src/ltm.h lua-5.5.1/src/ltm.h 52c52 < ** the table is using the dummy node; bit 7 is used for 'isrealasize'.) --- > ** the table is using the dummy node.) diff -Nr lua-5.5.0/src/lua.c lua-5.5.1/src/lua.c 32a33,38 > /* Name of the environment variable with the name of the readline library */ > #if !defined(LUA_RLLIB_VAR) > #define LUA_RLLIB_VAR "LUA_READLINELIB" > #endif > > 204c210 < return dochunk(L, luaL_loadfile(L, name)); --- > return dochunk(L, luaL_loadfilex(L, name, "bt")); 209c215 < return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); --- > return dochunk(L, luaL_loadbufferx(L, s, strlen(s), name, "t")); 263c269 < status = luaL_loadfile(L, fname); --- > status = luaL_loadfilex(L, fname, "bt"); 376a383,391 > static char *(*l_getenv)(const char *name); > > /* Function to ignore environment variables, used by option -E */ > static char *no_getenv (const char *name) { > UNUSED(name); > return NULL; > } > > 379c394 < const char *init = getenv(name + 1); --- > const char *init = l_getenv(name + 1); 382c397 < init = getenv(name + 1); /* try alternative name */ --- > init = l_getenv(name + 1); /* try alternative name */ 501,504c516,521 < void *lib = dlopen(LUA_READLINELIB, RTLD_NOW | RTLD_LOCAL); < if (lib == NULL) < lua_warning(L, "library '" LUA_READLINELIB "' not found", 0); < else { --- > const char *rllib = l_getenv(LUA_RLLIB_VAR); /* name of readline library */ > void *lib; /* library handle */ > if (rllib == NULL) /* no environment variable? */ > rllib = LUA_READLINELIB; /* use default name */ > lib = dlopen(rllib, RTLD_NOW | RTLD_LOCAL); > if (lib != NULL) { 510,512c527,533 < if (l_readline == NULL) < lua_warning(L, "unable to load 'readline'", 0); < } --- > if (l_readline != NULL) /* could load readline function? */ > return; /* everything ok */ > /* else emit a warning */ > } > lua_warning(L, "unable to load readline library '", 1); > lua_warning(L, rllib, 1); > lua_warning(L, "'", 0); 591c612 < int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); --- > int status = luaL_loadbufferx(L, retline, strlen(retline), "=stdin", "t"); 595c616 < lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ --- > lua_pop(L, 2); /* pop result from 'luaL_loadbufferx' and modified line */ 622c643 < int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ --- > int status = luaL_loadbufferx(L, line, len, "=stdin", "t"); /* try it */ 696c717,723 < #define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0) --- > #if defined(LUA_NODEBUGLIB) > /* With this option, code must require the debug library before using it */ > #define luai_openlibs(L) luaL_openselectedlibs(L, ~LUA_DBLIBK, LUA_DBLIBK) > #else > /* The default is to open all standard libraries */ > #define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0) > #endif 717a745 > l_getenv = &no_getenv; /* program will ignore environment variables */ 720a749,750 > else > l_getenv = &getenv; 725,728c755,756 < if (!(args & has_E)) { /* no option '-E'? */ < if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ < return 0; /* error running LUA_INIT */ < } --- > if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ > return 0; /* error running LUA_INIT */ diff -Nr lua-5.5.0/src/lua.h lua-5.5.1/src/lua.h 16c16 < #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2025 Lua.org, PUC-Rio" --- > #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2026 Lua.org, PUC-Rio" 22c22 < #define LUA_VERSION_RELEASE_N 0 --- > #define LUA_VERSION_RELEASE_N 1 524c524 < * Copyright (C) 1994-2025 Lua.org, PUC-Rio. --- > * Copyright (C) 1994-2026 Lua.org, PUC-Rio. diff -Nr lua-5.5.0/src/luaconf.h lua-5.5.1/src/luaconf.h 72a73 > #if !defined(LUA_READLINELIB) 74a76 > #endif 80c82 < #define LUA_READLINELIB "libedit.dylib" --- > #define LUA_USE_READLINE 227,229c229,231 < LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ < LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ < LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ --- > LUA_LDIR "?.lua;" LUA_LDIR "?\\init.lua;" \ > LUA_CDIR "?.lua;" LUA_CDIR "?\\init.lua;" \ > LUA_SHRDIR "?.lua;" LUA_SHRDIR "?\\init.lua;" \ 235,237c237,239 < LUA_CDIR"?.dll;" \ < LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ < LUA_CDIR"loadall.dll;" ".\\?.dll" --- > LUA_CDIR "?.dll;" \ > LUA_CDIR "..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ > LUA_CDIR "loadall.dll;" ".\\?.dll" 248,249c250,251 < LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ < LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ --- > LUA_LDIR "?.lua;" LUA_LDIR "?/init.lua;" \ > LUA_CDIR "?.lua;" LUA_CDIR "?/init.lua;" \ 255c257 < LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" --- > LUA_CDIR "?.so;" LUA_CDIR "loadall.so;" "./?.so" 342c344,346 < #define LUA_COMPAT_GLOBAL --- > #if !defined(LUA_COMPAT_GLOBAL) > #define LUA_COMPAT_GLOBAL 1 > #endif 652c656 < #if defined(__GNUC__) && !defined(LUA_NOBUILTIN) --- > #if !defined(LUA_NOBUILTIN) && defined(__GNUC__) && (__GNUC__ >= 3) 724,725c728,730 < @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure < ** maximum alignment for the other items in that union. --- > @@ LUAI_MAXALIGN defines fields that ensure proper alignment for > ** memory areas offered by Lua (e.g., userdata memory). > ** Add fields to it if you need alignment for non-ISO objects. 726a732,736 > #if defined(LLONG_MAX) > /* use ISO C99 stuff */ > #define LUAI_MAXALIGN long double u; void *s; long long l > #else > /* use only C89 stuff */ 727a738 > #endif diff -Nr lua-5.5.0/src/lundump.c lua-5.5.1/src/lundump.c 395c395,396 < LClosure *luaU_undump (lua_State *L, ZIO *Z, const char *name, int fixed) { --- > LClosure *luaU_undump (lua_State *L, ZIO *Z, Table *anchor, const char *name, > int fixed) { 408,411c409 < cl = luaF_newLclosure(L, loadByte(&S)); < setclLvalue2s(L, L->top.p, cl); < luaD_inctop(L); < S.h = luaH_new(L); /* create list of saved strings */ --- > S.h = anchor; 413,414c411,412 < sethvalue2s(L, L->top.p, S.h); /* anchor it */ < luaD_inctop(L); --- > cl = luaF_newLclosure(L, loadByte(&S)); > luaD_anchorobj(L, anchor, obj2gco(cl)); 421d418 < L->top.p--; /* pop table */ diff -Nr lua-5.5.0/src/lundump.h lua-5.5.1/src/lundump.h 33,34c33,34 < LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name, < int fixed); --- > LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Table *anchor, > const char* name, int fixed); diff -Nr lua-5.5.0/src/lutf8lib.c lua-5.5.1/src/lutf8lib.c 58a59,60 > else if (c >= 0xfe) /* c >= 1111 1110b ? */ > return NULL; /* would need six or more continuation bytes */ 66a69 > lua_assert(count <= 5); 68c71 < if (count > 5 || res > MAXUTF || res < limits[count]) --- > if (res > MAXUTF || res < limits[count]) 149c152 < lua_pushfstring(L, "%U", (long)code); --- > lua_pushfstring(L, "%U", cast(unsigned long, code)); diff -Nr lua-5.5.0/src/lvm.c lua-5.5.1/src/lvm.c 271c271 < ** written online with opcode OP_FORLOOP, for performance.) --- > ** written inline with opcode OP_FORLOOP, for performance.) 273c273 < static int floatforloop (StkId ra) { --- > static int floatforloop (lua_State *L, StkId ra) { 306c306 < setnilvalue(s2v(val)); /* result is nil */ --- > setnilvalue2s(val); /* result is nil */ 363,367c363,373 < t = tm; /* else repeat assignment over 'tm' */ < luaV_fastset(t, key, val, hres, luaH_pset); < if (hres == HOK) { < luaV_finishfastset(L, t, val); < return; /* done */ --- > t = tm; /* else must repeat assignment over 'tm' */ > /* do the equivalent to 'luaV_fastset', but saving 'h' */ > if (!ttistable(t)) > hres = HNOTATABLE; > else { > Table *h = hvalue(t); /* next call can change the value at 't' */ > hres = luaH_pset(h, key, val); > if (hres == HOK) { > luaC_barrierback(L, obj2gco(h), val); /* luaV_finishfastset */ > return; /* done */ > } 369c375 < /* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */ --- > /* else 'return luaV_finishset(L, t, key, val, hres)' (loop) */ 1844c1850 < else if (floatforloop(ra)) /* float loop */ --- > else if (floatforloop(L, ra)) /* float loop */