Lua diffu-lua-5.5.0-rc3-rc4


README

@@ -1,5 +1,5 @@
 
-This is Lua 5.5.0, released on 08 Dec 2025.
+This is Lua 5.5.0, released on 15 Dec 2025.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.
Binary files lua-5.5.0-rc3/doc/OSIApproved.png and lua-5.5.0-rc4/doc/OSIApproved.png differ
Binary files lua-5.5.0-rc3/doc/OSIApproved_100X125.png and lua-5.5.0-rc4/doc/OSIApproved_100X125.png differ

doc/manual.html

@@ -166,7 +166,7 @@
 <p>
 Unless stated otherwise,
 any overflow when manipulating integer values <em>wrap around</em>,
-according to the usual rules of two-complement arithmetic.
+according to the usual rules of two's complement arithmetic.
 (In other words,
 the actual result is the unique representable integer
 that is equal modulo <em>2<sup>n</sup></em> to the mathematical result,

@@ -2546,12 +2546,12 @@
 
 <p>
 A table with exactly one border is called a <em>sequence</em>.
-For instance, the table <code>{10, 20, 30, 40, 50}</code> is a sequence,
+For instance, the table <code>{10,20,30,40,50}</code> is a sequence,
 as it has only one border (5).
-The table <code>{10, 20, 30, nil, 50}</code> has two borders (3 and 5),
+The table <code>{10,20,30,nil,50}</code> has two borders (3 and 5),
 and therefore it is not a sequence.
 (The <b>nil</b> at index 4 is called a <em>hole</em>.)
-The table <code>{nil, 20, 30, nil, nil, 60, nil}</code>
+The table <code>{nil,20,30,nil,nil,60,nil}</code>
 has three borders (0, 3, and 6),
 so it is not a sequence, too.
 The table <code>{}</code> is a sequence with border 0.

@@ -2947,7 +2947,7 @@
 If the vararg table has a name,
 that name is not an upvalue in a nested function
 and it is used only as the base table
-in the syntactic constructions <code>t[exp]</code> or <code>t.id</code>).
+in the syntactic constructions <code>t[exp]</code> or <code>t.id</code>.
 Note that an anonymous vararg table always satisfy these conditions.
 
 

@@ -2979,22 +2979,22 @@
 <ul>
 
 <li>A <b>return</b> statement,
-for instance <code>return e1, e2, e3</code> (see <a href="#3.3.4">&sect;3.3.4</a>).</li>
+for instance <code>return e1,e2,e3</code> (see <a href="#3.3.4">&sect;3.3.4</a>).</li>
 
 <li>A table constructor,
-for instance <code>{e1, e2, e3}</code> (see <a href="#3.4.9">&sect;3.4.9</a>).</li>
+for instance <code>{e1,e2,e3}</code> (see <a href="#3.4.9">&sect;3.4.9</a>).</li>
 
 <li>The arguments of a function call,
-for instance <code>foo(e1, e2, e3)</code> (see <a href="#3.4.10">&sect;3.4.10</a>).</li>
+for instance <code>foo(e1,e2,e3)</code> (see <a href="#3.4.10">&sect;3.4.10</a>).</li>
 
 <li>A multiple assignment,
-for instance <code>a , b, c = e1, e2, e3</code> (see <a href="#3.3.3">&sect;3.3.3</a>).</li>
+for instance <code>a,b,c = e1,e2,e3</code> (see <a href="#3.3.3">&sect;3.3.3</a>).</li>
 
 <li>A local or global declaration,
 which is similar to a multiple assignment.</li>
 
 <li>The initial values in a generic <b>for</b> loop,
-for instance <code>for k in e1, e2, e3 do ... end</code> (see <a href="#3.3.5">&sect;3.3.5</a>).</li>
+for instance <code>for k in e1,e2,e3 do ... end</code> (see <a href="#3.3.5">&sect;3.3.5</a>).</li>
 
 </ul><p>
 In the last four cases,

@@ -3037,7 +3037,7 @@
 
 
 <p>
-Here are some examples of uses of mutlres expressions.
+Here are some examples of uses of multires expressions.
 In all cases, when the construction needs
 "the n-th result" and there is no such result,
 it uses a <b>nil</b>.

@@ -3755,7 +3755,7 @@
 </pre><p>
 Note that ISO&nbsp;C ensures
 that <code>free(NULL)</code> has no effect and that
-<code>realloc(NULL, size)</code> is equivalent to <code>malloc(size)</code>.
+<code>realloc(NULL,size)</code> is equivalent to <code>malloc(size)</code>.
 
 
 

@@ -4447,9 +4447,9 @@
 
 <p>
 By default this type is <code>long long</code>,
-(usually a 64-bit two-complement integer),
+(usually a 64-bit two's complement integer),
 but that can be changed to <code>long</code> or <code>int</code>
-(usually a 32-bit two-complement integer).
+(usually a 32-bit two's complement integer).
 (See <code>LUA_INT_TYPE</code> in <code>luaconf.h</code>.)
 
 

@@ -4780,7 +4780,7 @@
 
 <p>
 Creates a new empty table and pushes it onto the stack.
-It is equivalent to <code>lua_createtable(L, 0, 0)</code>.
+It is equivalent to <code>lua_createtable(L,0,0)</code>.
 
 
 

@@ -6846,7 +6846,7 @@
 
 <p>
 All functions and types from the auxiliary library
-are defined in header file <code>lauxlib.h</code> and
+are defined in the header file <code>lauxlib.h</code> and
 have a prefix <code>luaL_</code>.
 
 

@@ -7041,7 +7041,7 @@
 
 <li>First declare a variable <code>b</code> of type <a href="#luaL_Buffer"><code>luaL_Buffer</code></a>.</li>
 
-<li>Then initialize it with a call <code>luaL_buffinit(L, &amp;b)</code>.</li>
+<li>Then initialize it with a call <code>luaL_buffinit(L,&amp;b)</code>.</li>
 
 <li>
 Then add string pieces to the buffer calling any of

@@ -7064,12 +7064,12 @@
 <li>First declare a variable <code>b</code> of type <a href="#luaL_Buffer"><code>luaL_Buffer</code></a>.</li>
 
 <li>Then initialize it and preallocate a space of
-size <code>sz</code> with a call <code>luaL_buffinitsize(L, &amp;b, sz)</code>.</li>
+size <code>sz</code> with a call <code>luaL_buffinitsize(L,&amp;b,sz)</code>.</li>
 
 <li>Then produce the string into that space.</li>
 
 <li>
-Finish by calling <code>luaL_pushresultsize(&amp;b, sz)</code>,
+Finish by calling <code>luaL_pushresultsize(&amp;b,sz)</code>,
 where <code>sz</code> is the total size of the resulting string
 copied into that space (which may be less than or
 equal to the preallocated size).

@@ -7895,7 +7895,7 @@
 
 <p>
 You can retrieve an object referred by the reference <code>r</code>
-by calling <code>lua_rawgeti(L, t, r)</code> or <code>lua_geti(L, t, r)</code>.
+by calling <code>lua_rawgeti(L,t,r)</code> or <code>lua_geti(L,t,r)</code>.
 The function <a href="#luaL_unref"><code>luaL_unref</code></a> frees a reference.
 
 

@@ -8243,7 +8243,7 @@
 Alternatively,
 the host can select which libraries to open,
 by using <a href="#luaL_openselectedlibs"><code>luaL_openselectedlibs</code></a>.
-Both functions are defined in the header file <code>lualib.h</code>.
+Both functions are declared in the header file <code>lualib.h</code>.
 
 
 

@@ -9869,7 +9869,7 @@
 In particular,
 the call <code>string.sub(s,1,j)</code> returns a prefix of <code>s</code>
 with length <code>j</code>,
-and <code>string.sub(s, -i)</code> (for a positive <code>i</code>)
+and <code>string.sub(s,-i)</code> (for a positive <code>i</code>)
 returns a suffix of <code>s</code>
 with length <code>i</code>.
 

@@ -10389,7 +10389,7 @@
 A negative <code>n</code> gets characters before position <code>i</code>.
 The default for <code>i</code> is 1 when <code>n</code> is non-negative
 and <code>#s + 1</code> otherwise,
-so that <code>utf8.offset(s, -n)</code> gets the offset of the
+so that <code>utf8.offset(s,-n)</code> gets the offset of the
 <code>n</code>-th character from the end of the string.
 
 

@@ -10464,7 +10464,7 @@
 <p>
 Inserts element <code>value</code> at position <code>pos</code> in <code>list</code>,
 shifting up the elements
-<code>list[pos], list[pos+1], &middot;&middot;&middot;, list[#list]</code>.
+<code>list[pos],list[pos+1],&middot;&middot;&middot;,list[#list]</code>.
 The default value for <code>pos</code> is <code>#list+1</code>,
 so that a call <code>table.insert(t,x)</code> inserts <code>x</code> at the end
 of the list <code>t</code>.

@@ -10516,7 +10516,7 @@
 returning the value of the removed element.
 When <code>pos</code> is an integer between 1 and <code>#list</code>,
 it shifts down the elements
-<code>list[pos+1], list[pos+2], &middot;&middot;&middot;, list[#list]</code>
+<code>list[pos+1],list[pos+2],&middot;&middot;&middot;,list[#list]</code>
 and erases element <code>list[#list]</code>;
 The index <code>pos</code> can also be 0 when <code>#list</code> is 0,
 or <code>#list + 1</code>.

@@ -12499,7 +12499,7 @@
 
 <P CLASS="footer">
 Last update:
-Mon Dec  8 17:34:06 UTC 2025
+Mon Dec 15 21:02:05 UTC 2025
 </P>
 <!--
 Last change: revised for Lua 5.5.0

doc/readme.html

@@ -281,7 +281,7 @@
 <H2><A NAME="license">License</A></H2>
 <P>
 <A HREF="https://opensource.org/osd">
-<IMG SRC="OSIApproved_100X125.png" ALIGN="right" ALT="[Open Source Initiative Approved License]" STYLE="padding-left: 1em" WIDTH=50>
+<IMG SRC="OSIApproved.png" ALIGN="right" ALT="[Open Source Initiative Approved License]" STYLE="padding-left: 1em" WIDTH=50>
 </A>
 Lua is free software distributed under the terms of the
 <A HREF="https://opensource.org/license/mit">MIT license</A>

@@ -323,7 +323,7 @@
 
 <P CLASS="footer">
 Last update:
-Mon Dec  8 14:14:37 UTC 2025
+Wed Dec 10 11:37:23 UTC 2025
 </P>
 <!--
 Last change: revised for Lua 5.5.0

src/lauxlib.c

@@ -1185,7 +1185,7 @@
   lua_State *L = lua_newstate(luaL_alloc, NULL, luaL_makeseed(NULL));
   if (l_likely(L)) {
     lua_atpanic(L, &panic);
-    lua_setwarnf(L, warnfoff, L);  /* default is warnings off */
+    lua_setwarnf(L, warnfon, L);
   }
   return L;
 }

src/ldo.c

@@ -221,6 +221,17 @@
 
 
 /*
+** 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.
+*/
+int luaD_checkminstack (lua_State *L) {
+  return ((stacksize(L) < MAXSTACK - BASIC_STACK_SIZE) &&
+          (getCcalls(L) < LUAI_MAXCCALLS - 2));
+}
+
+
+/*
 ** In ISO C, any pointer use after the pointer has been deallocated is
 ** undefined behavior. So, before a stack reallocation, all pointers
 ** should be changed to offsets, and after the reallocation they should

src/ldo.h

@@ -89,6 +89,7 @@
 LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror);
 LUAI_FUNC void luaD_shrinkstack (lua_State *L);
 LUAI_FUNC void luaD_inctop (lua_State *L);
+LUAI_FUNC int luaD_checkminstack (lua_State *L);
 
 LUAI_FUNC l_noret luaD_throw (lua_State *L, TStatus errcode);
 LUAI_FUNC l_noret luaD_throwbaselevel (lua_State *L, TStatus errcode);

src/lgc.c

@@ -1293,7 +1293,7 @@
   correctgraylists(g);
   checkSizes(L, g);
   g->gcstate = GCSpropagate;  /* skip restart */
-  if (!g->gcemergency)
+  if (!g->gcemergency && luaD_checkminstack(L))
     callallpendingfinalizers(L);
 }
 

@@ -1667,12 +1667,13 @@
       break;
     }
     case GCScallfin: {  /* call finalizers */
-      if (g->tobefnz && !g->gcemergency) {
+      if (g->tobefnz && !g->gcemergency && luaD_checkminstack(L)) {
         g->gcstopem = 0;  /* ok collections during finalizers */
         GCTM(L);  /* call one finalizer */
         stepresult = CWUFIN;
       }
-      else {  /* emergency mode or no more finalizers */
+      else {  /* no more finalizers or emergency mode or no enough stack
+                 to run finalizers */
         g->gcstate = GCSpause;  /* finish collection */
         stepresult = step2pause;
       }

src/lua.c

@@ -349,6 +349,7 @@
 */
 static int runargs (lua_State *L, char **argv, int n) {
   int i;
+  lua_warning(L, "@off", 0);  /* by default, Lua stand-alone has warnings off */
   for (i = 1; i < n; i++) {
     int option = argv[i][1];
     lua_assert(argv[i][0] == '-');  /* already checked */

@@ -725,7 +726,7 @@
     if (handle_luainit(L) != LUA_OK)  /* run LUA_INIT */
       return 0;  /* error running LUA_INIT */
   }
-  if (!runargs(L, argv, optlim))  /* execute arguments -e and -l */
+  if (!runargs(L, argv, optlim))  /* execute arguments -e, -l, and -W */
     return 0;  /* something failed */
   if (script > 0) {  /* execute main script (if there is one) */
     if (handle_script(L, argv + script) != LUA_OK)