Lua diffs-lua-5.4.3-lua-5.4.4


Makefile

49c49
< R= $V.3
> R= $V.4

README

2c2
< This is Lua 5.4.3, released on 15 Mar 2021.
> This is Lua 5.4.4, released on 13 Jan 2022.

doc/contents.html

35c35
< Copyright &copy; 2020&ndash;2021 Lua.org, PUC-Rio.
> Copyright &copy; 2020&ndash;2022 Lua.org, PUC-Rio.

667c667
< Wed Mar  3 13:04:44 UTC 2021
> Thu Jan 13 11:32:22 UTC 2022

670c670
< Last change: revised for Lua 5.4.3
> Last change: revised for Lua 5.4.4

doc/manual.html

22c22
< Copyright &copy; 2020&ndash;2021 Lua.org, PUC-Rio.
> Copyright &copy; 2020&ndash;2022 Lua.org, PUC-Rio.

964,968c964,965
< Finalizers cannot yield.
< Except for that, they can do anything,
< such as raise errors, create new objects,
< or even run the garbage collector.
< However, because they can run in unpredictable times,
> Finalizers cannot yield nor run the garbage collector.
> Because they can run in unpredictable times,

1639,1640c1636,1639
< The assignment statement first evaluates all its expressions
< and only then the assignments are performed.
> If a variable is both assigned and read
> inside a multiple assignment,
> Lua ensures all reads get the value of the variable
> before the assignment.

1664a1664,1671
> Note that this guarantee covers only accesses
> syntactically inside the assignment statement.
> If a function or a metamethod called during the assignment
> changes the value of a variable,
> Lua gives no guarantees about the order of that access.
> 
> 
> <p>

2419c2426
< A <em>border</em> in a table <code>t</code> is any natural number
> A <em>border</em> in a table <code>t</code> is any non-negative integer

2423c2430,2431
<      (border == 0 or t[border] ~= nil) and t[border + 1] == nil
>      (border == 0 or t[border] ~= nil) and
>      (t[border + 1] == nil or border == math.maxinteger)

2426,2428c2434,2440
< a border is any (natural) index present in the table
< that is followed by an absent index
< (or zero, when index 1 is absent).
> a border is any positive integer index present in the table
> that is followed by an absent index,
> plus two limit cases:
> zero, when index 1 is absent;
> and the maximum value for an integer, when that index is present.
> Note that keys that are not positive integers
> do not interfere with borders.

2439,2440c2451
< has three borders (0, 3, and 6) and three holes
< (at indices 1, 4, and 5),
> has three borders (0, 3, and 6),

2443,2444d2453
< Note that non-natural keys do not interfere
< with whether a table is a sequence.

2462c2471
< where <em>n</em> is the largest natural key in the table.
> where <em>n</em> is the largest integer key in the table.

3981a3991,3994
> <p>
> This function should not be called by a finalizer.
> 
> 

5936c5949,5952
< you must call <a href="#lua_getinfo"><code>lua_getinfo</code></a>.
> you must call <a href="#lua_getinfo"><code>lua_getinfo</code></a> with an appropriate parameter.
> (Specifically, to get a field,
> you must add the letter between parentheses in the field's comment
> to the parameter <code>what</code> of <a href="#lua_getinfo"><code>lua_getinfo</code></a>.)

6113c6129,6132
< a value to be pushed on the stack:
> a value to be pushed on the stack.
> (These characters are also documented in the declaration of
> the structure <a href="#lua_Debug"><code>lua_Debug</code></a>,
> between parentheses in the comments following each field.)

6117c6136,6147
< <li><b>'<code>n</code>': </b> fills in the field <code>name</code> and <code>namewhat</code>;
> <li><b>'<code>f</code>': </b>
> pushes onto the stack the function that is
> running at the given level;
> </li>
> 
> <li><b>'<code>l</code>': </b> fills in the field <code>currentline</code>;
> </li>
> 
> <li><b>'<code>n</code>': </b> fills in the fields <code>name</code> and <code>namewhat</code>;
> </li>
> 
> <li><b>'<code>r</code>': </b> fills in the fields <code>ftransfer</code> and <code>ntransfer</code>;

6125,6127d6154
< <li><b>'<code>l</code>': </b> fills in the field <code>currentline</code>;
< </li>
< 

6135,6139d6161
< <li><b>'<code>f</code>': </b>
< pushes onto the stack the function that is
< running at the given level;
< </li>
< 

6141,6148c6163,6166
< pushes onto the stack a table whose indices are the
< numbers of the lines that are valid on the function.
< (A <em>valid line</em> is a line with some associated code,
< that is, a line where you can put a break point.
< Non-valid lines include empty lines and comments.)
< 
< 
< <p>
> pushes onto the stack a table whose indices are
> the lines on the function with some associated code,
> that is, the lines where you can put a break point.
> (Lines with no code include empty lines and comments.)

6151,6153d6168
< 
< 
< <p>

6511c6526
< <span class="apii">[-0, +0, <em>m</em>]</span>
> <span class="apii">[-?, +?, <em>m</em>]</span>

6565c6580
< <span class="apii">[-1, +?, <em>m</em>]</span>
> <span class="apii">[-?, +?, <em>m</em>]</span>

6719c6734
< <span class="apii">[-0, +0, &ndash;]</span>
> <span class="apii">[-0, +?, &ndash;]</span>

6757c6772
< <span class="apii">[-0, +0, &ndash;]</span>
> <span class="apii">[-?, +?, &ndash;]</span>

7559a7575,7579
> <p>
> A function with a <code>NULL</code> value represents a placeholder,
> which is filled with <b>false</b>.
> 
> 

7921a7942,7945
> <p>
> This function should not be called by a finalizer.
> 
> 

7939c7963
< Raises an error (see <a href="#2.3">&sect;2.3</a>) with @{message} as the error object.
> Raises an error (see <a href="#2.3">&sect;2.3</a>) with <code>message</code> as the error object.

8114,8116c8138,8139
< The behavior of <code>next</code> is undefined if,
< during the traversal,
< you assign any value to a non-existent field in the table.
> You should not assign any value to a non-existent field in a table
> during its traversal.

8162c8185
< which is true if the call succeeds without errors.
> which is <b>true</b> if the call succeeds without errors.

8442c8465
< Returns true when the coroutine <code>co</code> can yield.
> Returns <b>true</b> when the coroutine <code>co</code> can yield.

8486c8509
< true when the running coroutine is the main one.
> <b>true</b> when the running coroutine is the main one.

9024c9047
< A value of <b>true</b> as a fourth, optional argument <code>plain</code>
> A <b>true</b> as a fourth, optional argument <code>plain</code>

9049c9072
< <code>*</code>, <code>h</code>, <code>L</code>, <code>l</code>, and <code>n</code> are not supported
> <code>F</code>, <code>n</code>, <code>*</code>, <code>h</code>, <code>L</code>, and <code>l</code> are not supported

9050a9074,9075
> Both width and precision, when present,
> are limited to two digits.

9074c9099
< This specifier does not support modifiers (flags, width, length).
> This specifier does not support modifiers (flags, width, precision).

10365c10390
< true if and only if integer <code>m</code> is below integer <code>n</code> when
> <b>true</b> if and only if integer <code>m</code> is below integer <code>n</code> when

11927c11952
< Mon Mar 15 13:39:42 UTC 2021
> Thu Jan 13 11:33:16 UTC 2022

11930c11955
< Last change: revised for Lua 5.4.3
> Last change: revised for Lua 5.4.4

doc/readme.html

113c113
< the top-level directory, which is named <TT>lua-5.4.3</TT>.
> the top-level directory, which is named <TT>lua-5.4.4</TT>.

306c306
< Copyright &copy; 1994&ndash;2021 Lua.org, PUC-Rio.
> Copyright &copy; 1994&ndash;2022 Lua.org, PUC-Rio.

333c333
< Wed Mar  3 10:16:26 UTC 2021
> Mon Jan  3 09:54:18 UTC 2022

336c336
< Last change: revised for Lua 5.4.3
> Last change: revised for Lua 5.4.4

src/Makefile

82c82
< 	@echo "LDFLAGS= $(SYSLDFLAGS)"
> 	@echo "LDFLAGS= $(LDFLAGS)"

src/lapi.c

55a56,59
> /*
> ** Convert an acceptable index to a pointer to its respective value.
> ** Non-valid indices return the special nil value 'G(L)->nilvalue'.
> */

73,75c77
<     if (ttislcf(s2v(ci->func)))  /* light C function? */
<       return &G(L)->nilvalue;  /* it has no upvalues */
<     else {
>     if (ttisCclosure(s2v(ci->func))) {  /* C closure? */

79a82,85
>     else {  /* light C function or Lua function (through a hook)?) */
>       api_check(L, ttislcf(s2v(ci->func)), "caller not a C function");
>       return &G(L)->nilvalue;  /* no upvalues */
>     }

84c90,94
< static StkId index2stack (lua_State *L, int idx) {
> 
> /*
> ** Convert a valid actual index (not a pseudo-index) to its address.
> */
> l_sinline StkId index2stack (lua_State *L, int idx) {

88c98
<     api_check(L, o < L->top, "unacceptable index");
>     api_check(L, o < L->top, "invalid index");

221c231
< static void reverse (lua_State *L, StkId from, StkId to) {
> l_sinline void reverse (lua_State *L, StkId from, StkId to) {

441c451
< static void *touserdata (const TValue *o) {
> l_sinline void *touserdata (const TValue *o) {

633c643
< static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
> l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) {

708c718
< static int finishrawget (lua_State *L, const TValue *val) {
> l_sinline int finishrawget (lua_State *L, const TValue *val) {

1129c1139,1141
<   global_State *g;
>   global_State *g = G(L);
>   if (g->gcstp & GCSTPGC)  /* internal stop? */
>     return -1;  /* all options are invalid when stopped */

1131d1142
<   g = G(L);

1135c1146
<       g->gcrunning = 0;
>       g->gcstp = GCSTPUSR;  /* stopped by the user */

1140c1151
<       g->gcrunning = 1;
>       g->gcstp = 0;  /* (GCSTPGC must be already zero here) */

1159,1160c1170,1171
<       lu_byte oldrunning = g->gcrunning;
<       g->gcrunning = 1;  /* allow GC to run */
>       lu_byte oldstp = g->gcstp;
>       g->gcstp = 0;  /* allow GC to run (GCSTPGC must be zero here) */

1170c1181
<       g->gcrunning = oldrunning;  /* restore previous state */
>       g->gcstp = oldstp;  /* restore previous state */

1188c1199
<       res = g->gcrunning;
>       res = gcrunning(g);

src/lauxlib.c

883a884
>   idx = lua_absindex(L,idx);

src/lauxlib.h

105c105
< LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s,
> LUALIB_API void (luaL_addgsub) (luaL_Buffer *b, const char *s,

156a157,164
> /*
> ** Perform arithmetic operations on lua_Integer values with wrap-around
> ** semantics, as the Lua core does.
> */
> #define luaL_intop(op,v1,v2)  \
> 	((lua_Integer)((lua_Unsigned)(v1) op (lua_Unsigned)(v2)))
> 
> 

src/lbaselib.c

185,186c185,189
<   lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental"
<                                            : "generational");
>   if (oldmode == -1)
>     luaL_pushfail(L);  /* invalid call to 'lua_gc' */
>   else
>     lua_pushstring(L, (oldmode == LUA_GCINC) ? "incremental"
>                                              : "generational");

190a194,198
> /*
> ** check whether call to 'lua_gc' was valid (not inside a finalizer)
> */
> #define checkvalres(res) { if (res == -1) break; }
> 

202a211
>       checkvalres(k);

208a218
>       checkvalres(res);

215a226
>       checkvalres(previous);

220a232
>       checkvalres(res);

236a249
>       checkvalres(res);

240a254,255
>   luaL_pushfail(L);  /* invalid call (inside a finalizer) */
>   return 1;

263a279,283
> static int pairscont (lua_State *L, int status, lua_KContext k) {
>   (void)L; (void)status; (void)k;  /* unused */
>   return 3;
> }
> 

273c293
<     lua_call(L, 1, 3);  /* get 3 values from metamethod */
>     lua_callk(L, 1, 3, 0, pairscont);  /* get 3 values from metamethod */

283c303,304
<   lua_Integer i = luaL_checkinteger(L, 2) + 1;
>   lua_Integer i = luaL_checkinteger(L, 2);
>   i = luaL_intop(+, i, 1);

src/lcode.c

12a13
> #include <float.h>

583,585d583
< ** Integers use userdata as keys to avoid collision with floats with
< ** same value; conversion to 'void*' is used only for hashing, so there
< ** are no "precision" problems.

588,589c586
<   TValue k, o;
<   setpvalue(&k, cast_voidp(cast_sizet(n)));
>   TValue o;

591c588
<   return addk(fs, &k, &o);
>   return addk(fs, &o, &o);  /* use integer itself as key */

595c592,600
< ** Add a float to list of constants and return its index.
> ** Add a float to list of constants and return its index. Floats
> ** with integral values need a different key, to avoid collision
> ** with actual integers. To that, we add to the number its smaller
> ** power-of-two fraction that is still significant in its scale.
> ** For doubles, that would be 1/2^52.
> ** (This method is not bulletproof: there may be another float
> ** with that value, and for floats larger than 2^53 the result is
> ** still an integer. At worst, this only wastes an entry with
> ** a duplicate.)

598a604
>   lua_Integer ik;

600c606,618
<   return addk(fs, &o, &o);  /* use number itself as key */
>   if (!luaV_flttointeger(r, &ik, F2Ieq))  /* not an integral value? */
>     return addk(fs, &o, &o);  /* use number itself as key */
>   else {  /* must build an alternative key */
>     const int nbm = l_floatatt(MANT_DIG);
>     const lua_Number q = l_mathop(ldexp)(l_mathop(1.0), -nbm + 1);
>     const lua_Number k = (ik == 0) ? q : r + r*q;  /* new key */
>     TValue kv;
>     setfltvalue(&kv, k);
>     /* result is not an integral value, unless value is too large */
>     lua_assert(!luaV_flttointeger(k, &ik, F2Ieq) ||
>                 l_mathop(fabs)(r) >= l_mathop(1e6));
>     return addk(fs, &kv, &o);
>   }

src/lcorolib.c

81c81
<       lua_xmove(co, L, 1);  /* copy error message */
>       lua_xmove(co, L, 1);  /* move error message to the caller */

182c182
<         lua_xmove(co, L, 1);  /* copy error message */
>         lua_xmove(co, L, 1);  /* move error message */

src/ldebug.c

37,38c37,38
< static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
<                                     const char **name);
> static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
>                                                    const char **name);

67c67
<     /* estimate must be a lower bond of the correct base */
>     /* estimate must be a lower bound of the correct base */

304c304,311
<     for (i = 0; i < p->sizelineinfo; i++) {  /* for all instructions */
>     if (!p->is_vararg)  /* regular function? */
>       i = 0;  /* consider all instructions */
>     else {  /* vararg function */
>       lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP);
>       currentline = nextline(p, currentline, 0);
>       i = 1;  /* skip first instruction (OP_VARARGPREP) */
>     }
>     for (; i < p->sizelineinfo; i++) {  /* for each instruction */

313,321c320,322
<   if (ci == NULL)  /* no 'ci'? */
<     return NULL;  /* no info */
<   else if (ci->callstatus & CIST_FIN) {  /* is this a finalizer? */
<     *name = "__gc";
<     return "metamethod";  /* report it as such */
<   }
<   /* calling function is a known Lua function? */
<   else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
<     return funcnamefromcode(L, ci->previous, name);
>   /* calling function is a known function? */
>   if (ci != NULL && !(ci->callstatus & CIST_TAIL))
>     return funcnamefromcall(L, ci->previous, name);

593,594c594,595
< static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
<                                      const char **name) {
> static const char *funcnamefromcode (lua_State *L, const Proto *p,
>                                      int pc, const char **name) {

596,597d596
<   const Proto *p = ci_func(ci)->p;  /* calling function */
<   int pc = currentpc(ci);  /* calling instruction index */

599,602d597
<   if (ci->callstatus & CIST_HOOKED) {  /* was it called inside a hook? */
<     *name = "?";
<     return "hook";
<   }

638a634,653
> 
> /*
> ** Try to find a name for a function based on how it was called.
> */
> static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
>                                                    const char **name) {
>   if (ci->callstatus & CIST_HOOKED) {  /* was it called inside a hook? */
>     *name = "?";
>     return "hook";
>   }
>   else if (ci->callstatus & CIST_FIN) {  /* was it called as a finalizer? */
>     *name = "__gc";
>     return "metamethod";  /* report it as such */
>   }
>   else if (isLua(ci))
>     return funcnamefromcode(L, ci_func(ci)->p, currentpc(ci), name);
>   else
>     return NULL;
> }
> 

677a693,704
> static const char *formatvarinfo (lua_State *L, const char *kind,
>                                                 const char *name) {
>   if (kind == NULL)
>     return "";  /* no information */
>   else
>     return luaO_pushfstring(L, " (%s '%s')", kind, name);
> }
> 
> /*
> ** Build a string with a "description" for the value 'o', such as
> ** "variable 'x'" or "upvalue 'y'".
> */

679d705
<   const char *name = NULL;  /* to avoid warnings */

680a707
>   const char *name = NULL;  /* to avoid warnings */

688c715
<   return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : "";
>   return formatvarinfo(L, kind, name);

692c719,723
< l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
> /*
> ** Raise a type error
> */
> static l_noret typeerror (lua_State *L, const TValue *o, const char *op,
>                           const char *extra) {

694c725
<   luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o));
>   luaG_runerror(L, "attempt to %s a %s value%s", op, t, extra);

697a729,742
> /*
> ** Raise a type error with "standard" information about the faulty
> ** object 'o' (using 'varinfo').
> */
> l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
>   typeerror(L, o, op, varinfo(L, o));
> }
> 
> 
> /*
> ** Raise an error for calling a non-callable object. Try to find a name
> ** for the object based on how it was called ('funcnamefromcall'); if it
> ** cannot get a name there, try 'varinfo'.
> */

701,707c746,748
<   const char *what = (isLua(ci)) ? funcnamefromcode(L, ci, &name) : NULL;
<   if (what != NULL) {
<     const char *t = luaT_objtypename(L, o);
<     luaG_runerror(L, "%s '%s' is not callable (a %s value)", what, name, t);
<   }
<   else
<     luaG_typeerror(L, o, "call");
>   const char *kind = funcnamefromcall(L, ci, &name);
>   const char *extra = kind ? formatvarinfo(L, kind, name) : varinfo(L, o);
>   typeerror(L, o, "call", extra);

src/ldo.c

390,391c390,391
< void luaD_tryfuncTM (lua_State *L, StkId func) {
<   const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL);
> StkId luaD_tryfuncTM (lua_State *L, StkId func) {
>   const TValue *tm;

392a393,394
>   checkstackGCp(L, 1, func);  /* space for metamethod */
>   tm = luaT_gettmbyobj(L, s2v(func), TM_CALL);  /* (after previous GC) */

398a401
>   return func;

408c411
< static void moveresults (lua_State *L, StkId res, int nres, int wanted) {
> l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) {

475a479,513
> l_sinline CallInfo *prepCallInfo (lua_State *L, StkId func, int nret,
>                                                 int mask, StkId top) {
>   CallInfo *ci = L->ci = next_ci(L);  /* new frame */
>   ci->func = func;
>   ci->nresults = nret;
>   ci->callstatus = mask;
>   ci->top = top;
>   return ci;
> }
> 
> 
> /*
> ** precall for C functions
> */
> l_sinline int precallC (lua_State *L, StkId func, int nresults,
>                                             lua_CFunction f) {
>   int n;  /* number of returns */
>   CallInfo *ci;
>   checkstackGCp(L, LUA_MINSTACK, func);  /* ensure minimum stack size */
>   L->ci = ci = prepCallInfo(L, func, nresults, CIST_C,
>                                L->top + LUA_MINSTACK);
>   lua_assert(ci->top <= L->stack_last);
>   if (l_unlikely(L->hookmask & LUA_MASKCALL)) {
>     int narg = cast_int(L->top - func) - 1;
>     luaD_hook(L, LUA_HOOKCALL, -1, 1, narg);
>   }
>   lua_unlock(L);
>   n = (*f)(L);  /* do the actual call */
>   lua_lock(L);
>   api_checknelems(L, n);
>   luaD_poscall(L, ci, n);
>   return n;
> }
> 
> 

479c517,518
< ** (so that it includes the function itself).
> ** (so that it includes the function itself). Return the number of
> ** results, if it was a C function, or -1 for a Lua function.

481,496c520,553
< void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1) {
<   Proto *p = clLvalue(s2v(func))->p;
<   int fsize = p->maxstacksize;  /* frame size */
<   int nfixparams = p->numparams;
<   int i;
<   for (i = 0; i < narg1; i++)  /* move down function and arguments */
<     setobjs2s(L, ci->func + i, func + i);
<   checkstackGC(L, fsize);
<   func = ci->func;  /* moved-down function */
<   for (; narg1 <= nfixparams; narg1++)
<     setnilvalue(s2v(func + narg1));  /* complete missing arguments */
<   ci->top = func + 1 + fsize;  /* top for new function */
<   lua_assert(ci->top <= L->stack_last);
<   ci->u.l.savedpc = p->code;  /* starting point */
<   ci->callstatus |= CIST_TAIL;
<   L->top = func + narg1;  /* set top */
> int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func,
>                                     int narg1, int delta) {
>  retry:
>   switch (ttypetag(s2v(func))) {
>     case LUA_VCCL:  /* C closure */
>       return precallC(L, func, LUA_MULTRET, clCvalue(s2v(func))->f);
>     case LUA_VLCF:  /* light C function */
>       return precallC(L, func, LUA_MULTRET, fvalue(s2v(func)));
>     case LUA_VLCL: {  /* Lua function */
>       Proto *p = clLvalue(s2v(func))->p;
>       int fsize = p->maxstacksize;  /* frame size */
>       int nfixparams = p->numparams;
>       int i;
>       checkstackGCp(L, fsize - delta, func);
>       ci->func -= delta;  /* restore 'func' (if vararg) */
>       for (i = 0; i < narg1; i++)  /* move down function and arguments */
>         setobjs2s(L, ci->func + i, func + i);
>       func = ci->func;  /* moved-down function */
>       for (; narg1 <= nfixparams; narg1++)
>         setnilvalue(s2v(func + narg1));  /* complete missing arguments */
>       ci->top = func + 1 + fsize;  /* top for new function */
>       lua_assert(ci->top <= L->stack_last);
>       ci->u.l.savedpc = p->code;  /* starting point */
>       ci->callstatus |= CIST_TAIL;
>       L->top = func + narg1;  /* set top */
>       return -1;
>     }
>     default: {  /* not a function */
>       func = luaD_tryfuncTM(L, func);  /* try to get '__call' metamethod */
>       /* return luaD_pretailcall(L, ci, func, narg1 + 1, delta); */
>       narg1++;
>       goto retry;  /* try again */
>     }
>   }

509d565
<   lua_CFunction f;

513,514c569,570
<       f = clCvalue(s2v(func))->f;
<       goto Cfunc;
>       precallC(L, func, nresults, clCvalue(s2v(func))->f);
>       return NULL;

516,535c572
<       f = fvalue(s2v(func));
<      Cfunc: {
<       int n;  /* number of returns */
<       CallInfo *ci;
<       checkstackGCp(L, LUA_MINSTACK, func);  /* ensure minimum stack size */
<       L->ci = ci = next_ci(L);
<       ci->nresults = nresults;
<       ci->callstatus = CIST_C;
<       ci->top = L->top + LUA_MINSTACK;
<       ci->func = func;
<       lua_assert(ci->top <= L->stack_last);
<       if (l_unlikely(L->hookmask & LUA_MASKCALL)) {
<         int narg = cast_int(L->top - func) - 1;
<         luaD_hook(L, LUA_HOOKCALL, -1, 1, narg);
<       }
<       lua_unlock(L);
<       n = (*f)(L);  /* do the actual call */
<       lua_lock(L);
<       api_checknelems(L, n);
<       luaD_poscall(L, ci, n);
>       precallC(L, func, nresults, fvalue(s2v(func)));

537d573
<     }

545,546c581
<       L->ci = ci = next_ci(L);
<       ci->nresults = nresults;
>       L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize);

548,550d582
<       ci->top = func + 1 + fsize;
<       ci->func = func;
<       L->ci = ci;

557,558c589,590
<       checkstackGCp(L, 1, func);  /* space for metamethod */
<       luaD_tryfuncTM(L, func);  /* try to get '__call' metamethod */
>       func = luaD_tryfuncTM(L, func);  /* try to get '__call' metamethod */
>       /* return luaD_precall(L, func, nresults); */

570c602
< static void ccall (lua_State *L, StkId func, int nResults, int inc) {
> l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) {

731c763
<     ccall(L, firstArg - 1, LUA_MULTRET, 1);  /* just call its body */
>     ccall(L, firstArg - 1, LUA_MULTRET, 0);  /* just call its body */

735d766
<     luaE_incCstack(L);  /* control the C stack */

785a817,819
>   if (getCcalls(L) >= LUAI_MAXCCALLS)
>     return resume_error(L, "C stack overflow", nargs);
>   L->nCcalls++;

src/ldo.h

61c61
< LUAI_FUNC void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n);
> LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func,                                                    int narg1, int delta);

65c65
< LUAI_FUNC void luaD_tryfuncTM (lua_State *L, StkId func);
> LUAI_FUNC StkId luaD_tryfuncTM (lua_State *L, StkId func);

src/lgc.c

909c909,910
<     int running  = g->gcrunning;
>     int oldgcstp  = g->gcstp;
>     g->gcstp |= GCSTPGC;  /* avoid GC steps */

911d911
<     g->gcrunning = 0;  /* avoid GC steps */

918c918
<     g->gcrunning = running;  /* restore state */
>     g->gcstp = oldgcstp;  /* restore state */

920c920
<       luaE_warnerror(L, "__gc metamethod");
>       luaE_warnerror(L, "__gc");

1014c1014,1015
<       gfasttm(g, mt, TM_GC) == NULL)   /* or has no finalizer? */
>       gfasttm(g, mt, TM_GC) == NULL ||    /* or has no finalizer... */
>       (g->gcstp & GCSTPCLS))                   /* or closing state? */

1504a1506
>   g->gcstp = GCSTPCLS;  /* no extra finalizers after here */

1510c1512
<   deletelist(L, g->finobj, NULL);
>   lua_assert(g->finobj == NULL);  /* no new finalizers */

1649a1652
> 

1681c1684
<   if (g->gcrunning) {  /* running? */
>   if (gcrunning(g)) {  /* running? */

src/lgc.h

150a151,160
> 
> /*
> ** Control when GC is running:
> */
> #define GCSTPUSR	1  /* bit true when GC stopped by user */
> #define GCSTPGC		2  /* bit true when GC stopped by itself */
> #define GCSTPCLS	4  /* bit true when closing Lua state */
> #define gcrunning(g)	((g)->gcstp == 0)
> 
> 

src/llimits.h

168a169,182
> ** Inline functions
> */
> #if !defined(LUA_USE_C89)
> #define l_inline	inline
> #elif defined(__GNUC__)
> #define l_inline	__inline__
> #else
> #define l_inline	/* empty */
> #endif
> 
> #define l_sinline	static l_inline
> 
> 
> /*

350c364
< 	{ if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } }
> 	{ if (gcrunning(G(L))) { pre; luaC_fullgc(L, 0); pos; } }

src/lmathlib.c

478c478
< 	((lua_Number)1.0 / (UONE << 30) / 8.0 / (UONE << (FIGS - 33)))
>     (l_mathop(1.0) / (UONE << 30) / l_mathop(8.0) / (UONE << (FIGS - 33)))

489c489
< #define shiftHI		((lua_Number)(UONE << (FIGS - 33)) * 2.0)
> #define shiftHI		((lua_Number)(UONE << (FIGS - 33)) * l_mathop(2.0))

src/lobject.c

167c167
<   lua_Number r = 0.0;  /* result (accumulator) */
>   lua_Number r = l_mathop(0.0);  /* result (accumulator) */

177c177
<     return 0.0;  /* invalid format (no '0x') */
>     return l_mathop(0.0);  /* invalid format (no '0x') */

187c187
<           r = (r * cast_num(16.0)) + luaO_hexavalue(*s);
>           r = (r * l_mathop(16.0)) + luaO_hexavalue(*s);

194c194
<     return 0.0;  /* invalid format */
>     return l_mathop(0.0);  /* invalid format */

203c203
<       return 0.0;  /* invalid; must have at least one digit */
>       return l_mathop(0.0);  /* invalid; must have at least one digit */

src/lobject.h

71c71
< #define valraw(o)	(&val_(o))
> #define valraw(o)	(val_(o))

115c115
< /* main macro to copy values (from 'obj1' to 'obj2') */
> /* main macro to copy values (from 'obj2' to 'obj1') */

src/lopcodes.h

193c193,194
< ** grep "ORDER OP" if you change these enums
> ** Grep "ORDER OP" if you change these enums. Opcodes marked with a (*)
> ** has extra descriptions in the notes after the enumeration.

206c207
< OP_LFALSESKIP,/*A	R[A] := false; pc++				*/
> OP_LFALSESKIP,/*A	R[A] := false; pc++	(*)			*/

257c258
< OP_MMBIN,/*	A B C	call C metamethod over R[A] and R[B]		*/
> OP_MMBIN,/*	A B C	call C metamethod over R[A] and R[B]	(*)	*/

283c284
< OP_TESTSET,/*	A B k	if (not R[B] == k) then pc++ else R[A] := R[B]	*/
> OP_TESTSET,/*	A B k	if (not R[B] == k) then pc++ else R[A] := R[B] (*) */

317a319,330
> 
>   (*) Opcode OP_LFALSESKIP is used to convert a condition to a boolean
>   value, in a code equivalent to (not cond ? false : true).  (It
>   produces false and skips the next instruction producing true.)
> 
>   (*) Opcodes OP_MMBIN and variants follow each arithmetic and
>   bitwise opcode. If the operation succeeds, it skips this next
>   opcode. Otherwise, this opcode calls the corresponding metamethod.
> 
>   (*) Opcode OP_TESTSET is used in short-circuit expressions that need
>   both to jump and to produce a value, such as (a = b or c).
> 

src/lparser.c

419a420,430
> ** Mark that current block has a to-be-closed variable.
> */
> static void marktobeclosed (FuncState *fs) {
>   BlockCnt *bl = fs->bl;
>   bl->upval = 1;
>   bl->insidetbc = 1;
>   fs->needclose = 1;
> }
> 
> 
> /*

1602c1613
<   markupval(fs, fs->nactvar);  /* last control var. must be closed */
>   marktobeclosed(fs);  /* last control var. must be closed */

1706c1717
< static void checktoclose (LexState *ls, int level) {
> static void checktoclose (FuncState *fs, int level) {

1708,1710c1719
<     FuncState *fs = ls->fs;
<     markupval(fs, level + 1);
<     fs->bl->insidetbc = 1;  /* in the scope of a to-be-closed variable */
>     marktobeclosed(fs);

1754c1763
<   checktoclose(ls, toclose);
>   checktoclose(fs, toclose);

1778a1788
>   check_readonly(ls, &v);

src/lstate.c

169c169
<     luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */
>     luaD_throw(L, LUA_ERRERR);  /* error while handling stack error */

239c239
<   g->gcrunning = 1;  /* allow gc */
>   g->gcstp = 0;  /* allow gc */

272c272
<     luaC_freeallobjects(L);  /* jucst collect its objects */
>     luaC_freeallobjects(L);  /* just collect its objects */

273a274
>     L->ci = &L->base_ci;  /* unwind CallInfo list */

332a334
>   L->status = LUA_OK;  /* so it can run __close metamethods */

339d340
<   L->status = cast_byte(status);

375c376
<   g->gcrunning = 0;  /* no GC while building state */
>   g->gcstp = GCSTPGC;  /* no GC while building state */

src/lstate.h

168c168
< ** returning from a C function;
> ** returning from a function;

212c212
< #define CIST_FIN	(1<<7)	/* call is running a finalizer */
> #define CIST_FIN	(1<<7)	/* function "called" a finalizer */

266c266
<   lu_byte gcrunning;  /* true if GC is running */
>   lu_byte gcstp;  /* control whether GC is running */

src/lstrlib.c

1093,1094c1093,1109
< #if !defined(L_FMTFLAGS)
< #define L_FMTFLAGS	"-+ #0"
> #if !defined(L_FMTFLAGSF)
> 
> /* valid flags for a, A, e, E, f, F, g, and G conversions */
> #define L_FMTFLAGSF	"-+#0 "
> 
> /* valid flags for o, x, and X conversions */
> #define L_FMTFLAGSX	"-#0"
> 
> /* valid flags for d and i conversions */
> #define L_FMTFLAGSI	"-+0 "
> 
> /* valid flags for u conversions */
> #define L_FMTFLAGSU	"-0"
> 
> /* valid flags for c, p, and s conversions */
> #define L_FMTFLAGSC	"-"
> 

1099c1114,1117
< ** maximum size of each format specification (such as "%-099.99d")
> ** Maximum size of each format specification (such as "%-099.99d"):
> ** Initial '%', flags (up to 5), width (2), period, precision (2),
> ** length modifier (8), conversion specifier, and final '\0', plus some
> ** extra.

1192,1202c1210,1213
< static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
<   const char *p = strfrmt;
<   while (*p != '\0' && strchr(L_FMTFLAGS, *p) != NULL) p++;  /* skip flags */
<   if ((size_t)(p - strfrmt) >= sizeof(L_FMTFLAGS)/sizeof(char))
<     luaL_error(L, "invalid format (repeated flags)");
<   if (isdigit(uchar(*p))) p++;  /* skip width */
<   if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
<   if (*p == '.') {
<     p++;
<     if (isdigit(uchar(*p))) p++;  /* skip precision */
<     if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
> static const char *get2digits (const char *s) {
>   if (isdigit(uchar(*s))) {
>     s++;
>     if (isdigit(uchar(*s))) s++;  /* (2 digits at most) */

1204,1205c1215,1252
<   if (isdigit(uchar(*p)))
<     luaL_error(L, "invalid format (width or precision too long)");
>   return s;
> }
> 
> 
> /*
> ** Check whether a conversion specification is valid. When called,
> ** first character in 'form' must be '%' and last character must
> ** be a valid conversion specifier. 'flags' are the accepted flags;
> ** 'precision' signals whether to accept a precision.
> */
> static void checkformat (lua_State *L, const char *form, const char *flags,
>                                        int precision) {
>   const char *spec = form + 1;  /* skip '%' */
>   spec += strspn(spec, flags);  /* skip flags */
>   if (*spec != '0') {  /* a width cannot start with '0' */
>     spec = get2digits(spec);  /* skip width */
>     if (*spec == '.' && precision) {
>       spec++;
>       spec = get2digits(spec);  /* skip precision */
>     }
>   }
>   if (!isalpha(uchar(*spec)))  /* did not go to the end? */
>     luaL_error(L, "invalid conversion specification: '%s'", form);
> }
> 
> 
> /*
> ** Get a conversion specification and copy it to 'form'.
> ** Return the address of its last character.
> */
> static const char *getformat (lua_State *L, const char *strfrmt,
>                                             char *form) {
>   /* spans flags, width, and precision ('0' is included as a flag) */
>   size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789.");
>   len++;  /* adds following character (should be the specifier) */
>   /* still needs space for '%', '\0', plus a length modifier */
>   if (len >= MAX_FORMAT - 10)
>     luaL_error(L, "invalid format (too long)");

1207,1210c1254,1256
<   memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char));
<   form += (p - strfrmt) + 1;
<   *form = '\0';
<   return p;
>   memcpy(form, strfrmt, len * sizeof(char));
>   *(form + len) = '\0';
>   return strfrmt + len - 1;

1232a1279
>   const char *flags;

1242,1244c1289,1291
<       int maxitem = MAX_ITEM;
<       char *buff = luaL_prepbuffsize(&b, maxitem);  /* to put formatted item */
<       int nb = 0;  /* number of bytes in added item */
>       int maxitem = MAX_ITEM;  /* maximum length for the result */
>       char *buff = luaL_prepbuffsize(&b, maxitem);  /* to put result */
>       int nb = 0;  /* number of bytes in result */

1247c1294
<       strfrmt = scanformat(L, strfrmt, form);
>       strfrmt = getformat(L, strfrmt, form);

1249a1297
>           checkformat(L, form, L_FMTFLAGSC, 0);

1254c1302,1309
<         case 'o': case 'u': case 'x': case 'X': {
>           flags = L_FMTFLAGSI;
>           goto intcase;
>         case 'u':
>           flags = L_FMTFLAGSU;
>           goto intcase;
>         case 'o': case 'x': case 'X':
>           flags = L_FMTFLAGSX;
>          intcase: {

1255a1311
>           checkformat(L, form, flags, 1);

1260a1317
>           checkformat(L, form, L_FMTFLAGSF, 1);

1270a1328
>           checkformat(L, form, L_FMTFLAGSF, 1);

1276a1335
>           checkformat(L, form, L_FMTFLAGSC, 0);

1297c1356,1357
<             if (!strchr(form, '.') && l >= 100) {
>             checkformat(L, form, L_FMTFLAGSC, 1);
>             if (strchr(form, '.') == NULL && l >= 100) {

1355,1363d1414
< /* dummy structure to get native alignment requirements */
< struct cD {
<   char c;
<   union { double d; void *p; lua_Integer i; lua_Number n; } u;
< };
< 
< #define MAXALIGN	(offsetof(struct cD, u))
< 
< 

1437a1489,1490
>   /* dummy structure to get native alignment requirements */
>   struct cD { char c; union { LUAI_MAXALIGN; } u; };

1468c1521,1525
<     case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break;
>     case '!': {
>       const int maxalign = offsetof(struct cD, u);
>       h->maxalign = getnumlimit(h, fmt, maxalign);
>       break;
>     }

src/ltable.c

87,88d86
< #define hashint(t,i)		hashpow2(t, i)
< 

103a102,115
> /*
> ** Hash for integers. To allow a good hash, use the remainder operator
> ** ('%'). If integer fits as a non-negative int, compute an int
> ** remainder, which is faster. Otherwise, use an unsigned-integer
> ** remainder, which uses all bits and ensures a non-negative result.
> */
> static Node *hashint (const Table *t, lua_Integer i) {
>   lua_Unsigned ui = l_castS2U(i);
>   if (ui <= (unsigned int)INT_MAX)
>     return hashmod(t, cast_int(ui));
>   else
>     return hashmod(t, ui);
> }
> 

137,139c149
< ** the index of its hash value). The key comes broken (tag in 'ktt'
< ** and value in 'vkl') so that we can call it on keys inserted into
< ** nodes.
> ** the index of its hash value).

141,142c151,152
< static Node *mainposition (const Table *t, int ktt, const Value *kvl) {
<   switch (withvariant(ktt)) {
> static Node *mainpositionTV (const Table *t, const TValue *key) {
>   switch (ttypetag(key)) {

144,145c154,155
<       lua_Integer key = ivalueraw(*kvl);
<       return hashint(t, key);
>       lua_Integer i = ivalue(key);
>       return hashint(t, i);

148c158
<       lua_Number n = fltvalueraw(*kvl);
>       lua_Number n = fltvalue(key);

152c162
<       TString *ts = tsvalueraw(*kvl);
>       TString *ts = tsvalue(key);

156c166
<       TString *ts = tsvalueraw(*kvl);
>       TString *ts = tsvalue(key);

164c174
<       void *p = pvalueraw(*kvl);
>       void *p = pvalue(key);

168c178
<       lua_CFunction f = fvalueraw(*kvl);
>       lua_CFunction f = fvalue(key);

172c182
<       GCObject *o = gcvalueraw(*kvl);
>       GCObject *o = gcvalue(key);

179,183c189,192
< /*
< ** Returns the main position of an element given as a 'TValue'
< */
< static Node *mainpositionTV (const Table *t, const TValue *key) {
<   return mainposition(t, rawtt(key), valraw(key));
> l_sinline Node *mainpositionfromnode (const Table *t, Node *nd) {
>   TValue key;
>   getnodekey(cast(lua_State *, NULL), &key, nd);
>   return mainpositionTV(t, &key);

682c691
<     othern = mainposition(t, keytt(mp), &keyval(mp));
>     othern = mainpositionfromnode(t, mp);

src/ltablib.c

62d61
<   lua_Integer e = aux_getn(L, 1, TAB_RW) + 1;  /* first empty element */

63a63,64
>   lua_Integer e = aux_getn(L, 1, TAB_RW);
>   e = luaL_intop(+, e, 1);  /* first empty element */

150c151
<                   luaL_typename(L, -1), i);
>                   luaL_typename(L, -1), (LUAI_UACINT)i);

src/lua.c

92,99c92,100
<   "  -e stat  execute string 'stat'\n"
<   "  -i       enter interactive mode after executing 'script'\n"
<   "  -l name  require library 'name' into global 'name'\n"
<   "  -v       show version information\n"
<   "  -E       ignore environment variables\n"
<   "  -W       turn warnings on\n"
<   "  --       stop handling options\n"
<   "  -        stop handling options and execute stdin\n"
>   "  -e stat   execute string 'stat'\n"
>   "  -i        enter interactive mode after executing 'script'\n"
>   "  -l mod    require library 'mod' into global 'mod'\n"
>   "  -l g=mod  require library 'mod' into global 'g'\n"
>   "  -v        show version information\n"
>   "  -E        ignore environment variables\n"
>   "  -W        turn warnings on\n"
>   "  --        stop handling options\n"
>   "  -         stop handling options and execute stdin\n"

210,211c211
< ** Calls 'require(name)' and stores the result in a global variable
< ** with the given name.
> ** Receives 'globname[=modname]' and runs 'globname = require(modname)'.

213c213
< static int dolibrary (lua_State *L, const char *name) {
> static int dolibrary (lua_State *L, char *globname) {

214a215,221
>   char *modname = strchr(globname, '=');
>   if (modname == NULL)  /* no explicit name? */
>     modname = globname;  /* module name is equal to global name */
>   else {
>     *modname = '\0';  /* global name ends here */
>     modname++;  /* module name starts after the '=' */
>   }

216,217c223,224
<   lua_pushstring(L, name);
<   status = docall(L, 1, 1);  /* call 'require(name)' */
>   lua_pushstring(L, modname);
>   status = docall(L, 1, 1);  /* call 'require(modname)' */

219c226
<     lua_setglobal(L, name);  /* global[name] = require return */
>     lua_setglobal(L, globname);  /* globname = require(modname) */

330c337
<         const char *extra = argv[i] + 2;  /* both options need an argument */
>         char *extra = argv[i] + 2;  /* both options need an argument */

src/lua.h

21c21
< #define LUA_VERSION_RELEASE	"3"
> #define LUA_VERSION_RELEASE	"4"

24c24
< #define LUA_VERSION_RELEASE_NUM		(LUA_VERSION_NUM * 100 + 0)
> #define LUA_VERSION_RELEASE_NUM		(LUA_VERSION_NUM * 100 + 4)

28c28
< #define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2021 Lua.org, PUC-Rio"
> #define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2022 Lua.org, PUC-Rio"

495c495
< * Copyright (C) 1994-2021 Lua.org, PUC-Rio.
> * Copyright (C) 1994-2022 Lua.org, PUC-Rio.

src/luac.c

157a158
>   luaM_freearray(L,f->lineinfo,f->sizelineinfo);

603c604
< 	printf("%d %d %d",a,b,c);
> 	printf("%d %d %d%s",a,b,c,ISK);

607c608
< 	printf("%d %d %d",a,b,c);
> 	printf("%d %d %d%s",a,b,c,ISK);

622c623
< 	printf(COMMENT "to %d",pc+bx+2);
> 	printf(COMMENT "exit to %d",pc+bx+3);

src/luaconf.h

488d487
< @@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED.

509,511d507
< #define LUA_UNSIGNEDBITS	(sizeof(LUA_UNSIGNED) * CHAR_BIT)
< 
< 

src/lutf8lib.c

227,232c227,229
<   lua_Integer n = lua_tointeger(L, 2) - 1;
<   if (n < 0)  /* first iteration? */
<     n = 0;  /* start from here */
<   else if (n < (lua_Integer)len) {
<     n++;  /* skip current byte */
<     while (iscont(s + n)) n++;  /* and its continuations */
>   lua_Unsigned n = (lua_Unsigned)lua_tointeger(L, 2);
>   if (n < len) {
>     while (iscont(s + n)) n++;  /* skip continuation bytes */

234c231
<   if (n >= (lua_Integer)len)
>   if (n >= len)  /* (also handles original 'n' being negative) */

src/lvm.c

409c409
< static int LTintfloat (lua_Integer i, lua_Number f) {
> l_sinline int LTintfloat (lua_Integer i, lua_Number f) {

426c426
< static int LEintfloat (lua_Integer i, lua_Number f) {
> l_sinline int LEintfloat (lua_Integer i, lua_Number f) {

443c443
< static int LTfloatint (lua_Number f, lua_Integer i) {
> l_sinline int LTfloatint (lua_Number f, lua_Integer i) {

460c460
< static int LEfloatint (lua_Number f, lua_Integer i) {
> l_sinline int LEfloatint (lua_Number f, lua_Integer i) {

476c476
< static int LTnum (const TValue *l, const TValue *r) {
> l_sinline int LTnum (const TValue *l, const TValue *r) {

498c498
< static int LEnum (const TValue *l, const TValue *r) {
> l_sinline int LEnum (const TValue *l, const TValue *r) {

769c769,770
< #define luaV_shiftr(x,y)	luaV_shiftl(x,-(y))
> #define luaV_shiftr(x,y)	luaV_shiftl(x,intop(-, 0, y))
> 

850c851
<     case OP_CLOSE:  case OP_RETURN: {  /* yielded closing variables */
>     case OP_CLOSE: {  /* yielded closing variables */

853a855,863
>     case OP_RETURN: {  /* yielded closing variables */
>       StkId ra = base + GETARG_A(inst);
>       /* adjust top to signal correct number of returns, in case the
>          return is "up to top" ('isIT') */
>       L->top = ra + ci->u2.nres;
>       /* repeat instruction to close other vars. and complete the return */
>       ci->u.l.savedpc--;
>       break;
>     }

1102c1112
< ** Protect code that can only raise errors. (That is, it cannnot change
> ** Protect code that can only raise errors. (That is, it cannot change

1159,1160c1169,1172
< // low-level line tracing for debugging Lua
< // printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p)));
>     #if 0
>       /* low-level line tracing for debugging Lua */
>       printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p)));
>     #endif

1628d1639
<           ci->callstatus = 0;  /* call re-uses 'luaV_execute' */

1634a1646
>         int n;  /* number of results when calling a C function */

1648,1656c1660,1662
<         while (!ttisfunction(s2v(ra))) {  /* not a function? */
<           luaD_tryfuncTM(L, ra);  /* try '__call' metamethod */
<           b++;  /* there is now one extra argument */
<           checkstackGCp(L, 1, ra);
<         }
<         if (!ttisLclosure(s2v(ra))) {  /* C function? */
<           luaD_precall(L, ra, LUA_MULTRET);  /* call it */
<           updatetrap(ci);
<           updatestack(ci);  /* stack may have been relocated */
>         if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0)  /* Lua function? */
>           goto startfunc;  /* execute the callee */
>         else {  /* C function? */

1658c1664
<           luaD_poscall(L, ci, cast_int(L->top - ra));  /* finish caller */
>           luaD_poscall(L, ci, n);  /* finish caller */

1662,1664d1667
<         ci->func -= delta;  /* restore 'func' (if vararg) */
<         luaD_pretailcall(L, ci, ra, b);  /* prepare call frame */
<         goto startfunc;  /* execute the callee */

1672a1676
>           ci->u2.nres = n;  /* save number of returns */