Lua diffs-lua-5.3.3-lua-5.3.4-rc1


Makefile

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

README

2c2
< This is Lua 5.3.3, released on 30 May 2016.
> This is Lua 5.3.4, released on 02 Jan 2017.

doc/contents.html

35c35
< Copyright &copy; 2015&ndash;2016 Lua.org, PUC-Rio.
> Copyright &copy; 2015&ndash;2017 Lua.org, PUC-Rio.

514a515
> <A HREF="manual.html#luaL_opt">luaL_opt</A><BR>

611c612
< Thu Jan 14 10:14:28 BRST 2016
> Thu Dec 22 18:29:39 BRST 2016

614c615
< Last change: revised for Lua 5.3.3
> Last change: revised for Lua 5.3.4
Binary files lua-5.3.3/doc/logo.gif and lua-5.3.4-rc1/doc/logo.gif differ

doc/lua.1

1c1,2
< .TH LUA 1 "$Date: 2014/12/10 15:55:45 $"
> .\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $
> .TH LUA 1 "$Date: 2016/10/17 15:43:50 $"

doc/manual.html

22c22
< Copyright &copy; 2015&ndash;2016 Lua.org, PUC-Rio.
> Copyright &copy; 2015&ndash;2017 Lua.org, PUC-Rio.

38c38
< <!-- $Id: manual.of,v 1.162 2016/05/30 15:57:03 roberto Exp $ -->
> <!-- $Id: manual.of,v 1.166 2016/12/22 15:46:25 roberto Exp $ -->

219c219
< they can be used to represent ordinary arrays, sequences,
> they can be used to represent ordinary arrays, lists,

229,235d228
< We use the term <em>sequence</em> to denote a table where
< the set of all positive numeric keys is equal to {1..<em>n</em>}
< for some non-negative integer <em>n</em>,
< which is called the length of the sequence (see <a href="#3.4.7">&sect;3.4.7</a>).
< 
< 
< <p>

380a374,376
> (The message handler is called only for regular runtime errors.
> It is not called for memory-allocation errors
> nor for errors while running finalizers.)

876c872
< Values, such as numbers and light C functions,
> Values, such as numbers and light C&nbsp;functions,

1087c1083
< programs should avoid creating 
> programs should avoid creating

1104c1100
< <em>Literal strings</em>
> A <em>short literal string</em>

1117c1113
< A backslash followed by a real newline
> A backslash followed by a line break

1124a1121,1122
> A short literal string cannot contain unescaped line breaks
> nor escapes not forming a valid escape sequence.

1128,1131c1126,1127
< Strings in Lua can contain any 8-bit value, including embedded zeros,
< which can be specified as '<code>\0</code>'.
< More generally,
< we can specify any byte in a literal string by its numeric value.
> We can specify any byte in a short literal string by its numeric value
> (including embedded zeros).

1175,1185d1170
< Any byte in a literal string not
< explicitly affected by the previous rules represents itself.
< However, Lua opens files for parsing in text mode,
< and the system file functions may have problems with
< some control characters.
< So, it is safer to represent
< non-text data as a quoted literal with
< explicit escape sequences for the non-text characters.
< 
< 
< <p>

1205a1191,1201
> Any byte in a literal string not
> explicitly affected by the previous rules represents itself.
> However, Lua opens files for parsing in text mode,
> and the system file functions may have problems with
> some control characters.
> So, it is safer to represent
> non-text data as a quoted literal with
> explicit escape sequences for the non-text characters.
> 
> 
> <p>

1215c1211
< A numeric constant with a radix point or an exponent 
> A numeric constant with a radix point or an exponent

1900c1896
< Floor division (<code>//</code>) is a division 
> Floor division (<code>//</code>) is a division

1962c1958
< besides strings. 
> besides strings.

2000c1996
< All conversions from strings to numbers 
> All conversions from strings to numbers

2142a2139,2141
> 
> 
> <p>

2149,2150c2148,2159
< A program can modify the behavior of the length operator for
< any value but strings through the <code>__len</code> metamethod (see <a href="#2.4">&sect;2.4</a>).
> The length operator applied on a table
> returns a border in that table.
> A <em>border</em> in a table <code>t</code> is any natural number
> that satisfies the following condition:
> 
> <pre>
>      (border == 0 or t[border] ~= nil) and t[border + 1] == nil
> </pre><p>
> In words,
> a border is any (natural) index in a table
> where a non-nil value is followed by a nil value
> (or zero, when index 1 is nil).

2154,2170c2163,2171
< Unless a <code>__len</code> metamethod is given,
< the length of a table <code>t</code> is only defined if the
< table is a <em>sequence</em>,
< that is,
< the set of its positive numeric keys is equal to <em>{1..n}</em>
< for some non-negative integer <em>n</em>.
< In that case, <em>n</em> is its length.
< Note that a table like
< 
< <pre>
<      {10, 20, nil, 40}
< </pre><p>
< is not a sequence, because it has the key <code>4</code>
< but does not have the key <code>3</code>.
< (So, there is no <em>n</em> such that the set <em>{1..n}</em> is equal
< to the set of positive numeric keys of that table.)
< Note, however, that non-numeric keys do not interfere
> 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,
> as it has only one border (5).
> The table <code>{10, 20, 30, nil, 50}</code> has two borders (3 and 5),
> and therefore it is not a sequence.
> The table <code>{nil, 20, 30, nil, 50, nil}</code> has three borders (0, 3 and 5),
> so it also is not a sequence.
> The table <code>{}</code> is a sequence with border 0.
> Note that non-natural keys do not interfere

2173a2175,2191
> <p>
> When <code>t</code> is a sequence,
> <code>#t</code> returns its only border,
> which corresponds to the intuitive notion of the length of the sequence.
> When <code>t</code> is not a sequence,
> <code>#t</code> can return any of its borders.
> (The exact one depends on details of
> the internal representation of the table,
> which in turn can depend on how the table was populated and
> the memory addresses of its non-numeric keys.)
> 
> 
> <p>
> A program can modify the behavior of the length operator for
> any value but strings through the <code>__len</code> metamethod (see <a href="#2.4">&sect;2.4</a>).
> 
> 

2587a2606,2627
> <p>
> The Lua library is fully reentrant:
> it has no global variables.
> It keeps all information it needs in a dynamic structure,
> called the <em>Lua state</em>.
> 
> 
> <p>
> Each Lua state has one or more threads,
> which correspond to independent, cooperative lines of execution.
> The type <a href="#lua_State"><code>lua_State</code></a> (despite its name) refers to a thread.
> (Indirectly, through the thread, it also refers to the
> Lua state associated to the thread.)
> 
> 
> <p>
> A pointer to a thread must be passed as the first argument to
> every function in the library, except to <a href="#lua_newstate"><code>lua_newstate</code></a>,
> which creates a Lua state from scratch and returns a pointer
> to the <em>main thread</em> in the new state.
> 
> 

2594a2635,2636
> Functions in the API can access this stack through the
> Lua state parameter that they receive.

2602c2644,2645
< and it is where the C&nbsp;function pushes its results
> and it is where the C&nbsp;function can store temporary
> Lua values and must push its results

2794,2795c2837
< (such as a memory allocation error, type errors, syntax errors,
< and runtime errors)
> (such as a memory allocation error or a type error)

2803a2846,2856
> Inside a C&nbsp;function you can raise an error by calling <a href="#lua_error"><code>lua_error</code></a>.
> 
> 
> <p>
> Most functions in the API can raise an error,
> for instance due to a memory allocation error.
> The documentation for each function indicates whether
> it can raise errors.
> 
> 
> <p>

2813a2867,2883
> The panic function,
> as its name implies,
> is a mechanism of last resort.
> Programs should avoid it.
> As a general rule,
> when a C&nbsp;function is called by Lua with a Lua state,
> it can do whatever it wants on that Lua state,
> as it should be already protected.
> However,
> when C code operates on other Lua states
> (e.g., a Lua parameter to the function,
> a Lua state stored in the registry, or
> the result of <a href="#lua_newthread"><code>lua_newthread</code></a>),
> it should use them only in API calls that cannot raise errors.
> 
> 
> <p>

2821,2831d2890
< <p>
< Most functions in the API can raise an error,
< for instance due to a memory allocation error.
< The documentation for each function indicates whether
< it can raise errors.
< 
< 
< <p>
< Inside a C&nbsp;function you can raise an error by calling <a href="#lua_error"><code>lua_error</code></a>.
< 
< 

2839c2898
< Therefore, if a C function <code>foo</code> calls an API function
> Therefore, if a C&nbsp;function <code>foo</code> calls an API function

2857c2916
< We have a C function called from Lua which we will call
> We have a C&nbsp;function called from Lua which we will call

3172c3231
< In this case, all results from the function are pushed.
> In this case, all results from the function are pushed;

3658c3717
< Pushes onto the stack the Lua value associated with the userdata
> Pushes onto the stack the Lua value associated with the full userdata

4001c4060,4061
< Lua does all memory allocation for this state through this function.
> Lua does all memory allocation for this state
> through this function (see <a href="#lua_Alloc"><code>lua_Alloc</code></a>).

4205c4265,4267
< (This error typically has no relation with the function being called.)
> For such errors, Lua does not call the message handler
> (as this kind of error typically has no relation
> with the function being called).

4281c4343
< this function creates a <em>light C function</em>,
> this function creates a <em>light N{C function}</em>,

4295c4357
< This function receives a pointer to a C function
> This function receives a pointer to a C&nbsp;function

4670c4732
< Sets the C function <code>f</code> as the new value of global <code>name</code>.
> Sets the C&nbsp;function <code>f</code> as the new value of global <code>name</code>.

4891c4953
< the new value associated to the userdata at the given index.
> the new value associated to the full userdata at the given index.

5305c5367
< the execution of the C function that yielded (see <a href="#4.7">&sect;4.7</a>).
> the execution of the C&nbsp;function that yielded (see <a href="#4.7">&sect;4.7</a>).

6016c6078
< of the C function that called it,
> of the C&nbsp;function that called it,

6537c6599,6600
< if it cannot open/read the file or the file has a wrong mode.
> for file-related errors
> (e.g., it cannot open or read the file).

6729a6793,6797
> <p>
> This function uses <a href="#lua_tolstring"><code>lua_tolstring</code></a> to get its result,
> so all conversions and caveats of that function apply here.
> 
> 

7677c7745
< it is not inside a non-yieldable C function.
> it is not inside a non-yieldable C&nbsp;function.

7879,7880c7947,7948
< using the environment variable <a name="pdf-LUA_CPATH_5_3"><code>LUA_CPATH_5_3</code></a>
< or the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a>
> using the environment variable <a name="pdf-LUA_CPATH_5_3"><code>LUA_CPATH_5_3</code></a>,
> or the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a>,

8437c8505
< according to the format string <code>fmt</code> (see <a href="#6.4.2">&sect;6.4.2</a>). 
> according to the format string <code>fmt</code> (see <a href="#6.4.2">&sect;6.4.2</a>).

8488c8556,8557
< and <code>string.sub(s, -i)</code> returns a suffix of <code>s</code>
> and <code>string.sub(s, -i)</code> (for a positive <code>i</code>)
> returns a suffix of <code>s</code>

8905c8974
< returns a false value plus the position of the first invalid byte. 
> returns a false value plus the position of the first invalid byte.

8949,8950c9018
< the table must be a proper sequence
< or have a <code>__len</code> metamethod (see <a href="#3.4.7">&sect;3.4.7</a>).
> all caveats about the length operator apply (see <a href="#3.4.7">&sect;3.4.7</a>).

9066,9068c9134,9135
< The sort algorithm is not stable;
< that is, elements not comparable by the given order
< (e.g., equal elements)
> The sort algorithm is not stable:
> elements considered equal by the given order

9404c9471
< true if integer <code>m</code> is below integer <code>n</code> when
> true if and only if integer <code>m</code> is below integer <code>n</code> when

9989a10057
> Otherwise, it returns true.

9999c10067
< Renames file or directory named <code>oldname</code> to <code>newname</code>.
> Renames the file or directory named <code>oldname</code> to <code>newname</code>.

10001a10070
> Otherwise, it returns true.

10294c10363
< If <code>u</code> is not a userdata,
> If <code>u</code> is not a full userdata,

10493c10562
< When called without option <code>-E</code>, 
> When called without option <code>-E</code>,

10585c10654
< If the error object is not a string but 
> If the error object is not a string but

10900d10968
< 

10903c10971
< Mon May 30 13:11:08 BRT 2016
> Thu Dec 22 18:22:25 BRST 2016

10906c10974
< Last change: revised for Lua 5.3.3
> Last change: revised for Lua 5.3.4

doc/readme.html

331c331
< Copyright &copy; 1994&ndash;2016 Lua.org, PUC-Rio.
> Copyright &copy; 1994&ndash;2017 Lua.org, PUC-Rio.

358c358
< Tue Feb  2 22:25:27 BRST 2016
> Thu Dec 22 18:22:57 BRST 2016

361c361
< Last change: revised for Lua 5.3.3
> Last change: revised for Lua 5.3.4

src/lauxlib.c

2c2
< ** $Id: lauxlib.c,v 1.286 2016/01/08 15:33:09 roberto Exp $
> ** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $

72d71
< ** (registry._LOADED).

77c76
<   lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
>   lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);

812c811,815
<   if (!luaL_callmeta(L, idx, "__tostring")) {  /* no metafield? */
>   if (luaL_callmeta(L, idx, "__tostring")) {  /* metafield? */
>     if (!lua_isstring(L, -1))
>       luaL_error(L, "'__tostring' must return a string");
>   }
>   else {

816c819
<           lua_pushfstring(L, "%I", lua_tointeger(L, idx));
>           lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx));

818c821
<           lua_pushfstring(L, "%f", lua_tonumber(L, idx));
>           lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx));

830,832c833,839
<       default:
<         lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
<                                             lua_topointer(L, idx));
>       default: {
>         int tt = luaL_getmetafield(L, idx, "__name");  /* try name */
>         const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) :
>                                                  luaL_typename(L, idx);
>         lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx));
>         if (tt != LUA_TNIL)
>           lua_remove(L, -2);  /* remove '__name' */

833a841
>       }

885c893
< ** first looks at the _LOADED table and, if that fails, try a
> ** first looks at the LOADED table and, if that fails, try a

891,892c899,900
<   luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);  /* get _LOADED table */
<   if (lua_getfield(L, -1, modname) != LUA_TTABLE) {  /* no _LOADED[modname]? */
>   luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1);
>   if (lua_getfield(L, -1, modname) != LUA_TTABLE) {  /* no LOADED[modname]? */

899c907
<     lua_setfield(L, -3, modname);  /* _LOADED[modname] = new table */
>     lua_setfield(L, -3, modname);  /* LOADED[modname] = new table */

901c909
<   lua_remove(L, -2);  /* remove _LOADED table */
>   lua_remove(L, -2);  /* remove LOADED table */

965,966c973,974
<   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
<   lua_getfield(L, -1, modname);  /* _LOADED[modname] */
>   luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
>   lua_getfield(L, -1, modname);  /* LOADED[modname] */

973c981
<     lua_setfield(L, -3, modname);  /* _LOADED[modname] = module */
>     lua_setfield(L, -3, modname);  /* LOADED[modname] = module */

975c983
<   lua_remove(L, -2);  /* remove _LOADED table */
>   lua_remove(L, -2);  /* remove LOADED table */

1033c1041
<                   ver, *v);
>                   (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v);

src/lauxlib.h

2c2
< ** $Id: lauxlib.h,v 1.129 2015/11/23 11:29:43 roberto Exp $
> ** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $

19c19
< /* extra error code for 'luaL_load' */
> /* extra error code for 'luaL_loadfilex' */

22a23,30
> /* key, in the registry, for table of loaded modules */
> #define LUA_LOADED_TABLE	"_LOADED"
> 
> 
> /* key, in the registry, for table of preloaded loaders */
> #define LUA_PRELOAD_TABLE	"_PRELOAD"
> 
> 

src/lbaselib.c

2c2
< ** $Id: lbaselib.c,v 1.313 2016/04/11 19:18:40 roberto Exp $
> ** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $

210a211
>   luaL_checkany(L, 1);

212d212
<     luaL_checktype(L, 1, LUA_TTABLE);  /* argument must be a table */

src/lcode.c

2c2
< ** $Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp $
> ** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $

43c43
< static int tonumeral(expdesc *e, TValue *v) {
> static int tonumeral(const expdesc *e, TValue *v) {

89c89
< */ 
> */

757c757
< */  
> */

978c978,979
< static int constfolding (FuncState *fs, int op, expdesc *e1, expdesc *e2) {
> static int constfolding (FuncState *fs, int op, expdesc *e1,
>                                                 const expdesc *e2) {

1016a1018,1020
> ** Because 'luaK_exp2RK' can free registers, its calls must be
> ** in "stack order" (that is, first on 'e2', which may have more
> ** recent registers to be released).

1020,1021c1024,1025
<   int rk1 = luaK_exp2RK(fs, e1);  /* both operands are "RK" */
<   int rk2 = luaK_exp2RK(fs, e2);
>   int rk2 = luaK_exp2RK(fs, e2);  /* both operands are "RK" */
>   int rk1 = luaK_exp2RK(fs, e1);

1063c1067
<   static expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};  /* fake 2nd operand */
>   static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};

1065c1069
<     case OPR_MINUS: case OPR_BNOT:
>     case OPR_MINUS: case OPR_BNOT:  /* use 'ef' as fake 2nd operand */

src/ldebug.c

2c2
< ** $Id: ldebug.c,v 2.120 2016/03/31 19:01:21 roberto Exp $
> ** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $

41c41,42
< static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
> static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
>                                     const char **name);

246a248,261
> static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
>   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);
>   else return NULL;  /* no way to find a name */
> }
> 
> 

277,281c292
<         /* calling function is a known Lua function? */
<         if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
<           ar->namewhat = getfuncname(L, ci->previous, &ar->name);
<         else
<           ar->namewhat = NULL;
>         ar->namewhat = getfuncname(L, ci, &ar->name);

474,475c485,493
< static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
<   TMS tm = (TMS)0;  /* to avoid warnings */
> /*
> ** Try to find a name for a function based on the code that called it.
> ** (Only works when function was called by a Lua function.)
> ** Returns what the name is (e.g., "for iterator", "method",
> ** "metamethod") and sets '*name' to point to the name.
> */
> static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
>                                      const char **name) {
>   TMS tm = (TMS)0;  /* (initial value avoids warnings) */

485,486c503,504
<     case OP_TAILCALL:  /* get function name */
<       return getobjname(p, pc, GETARG_A(i), name);
>     case OP_TAILCALL:
>       return getobjname(p, pc, GETARG_A(i), name);  /* get function name */

491c509
<     /* all other instructions can call only through metamethods */
>     /* other instructions can do calls through metamethods */

512c530,531
<     default: lua_assert(0);  /* other instructions cannot call a function */
>     default:
>       return NULL;  /* cannot find a reasonable name */

src/ldo.c

2c2
< ** $Id: ldo.c,v 2.151 2015/12/16 16:40:07 roberto Exp $
> ** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $

214d213
<     lua_assert(ci->top <= L->stack_last);

216a216
>   lua_assert(lim <= L->stack_last);

224,225c224,226
<   if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK;
<   if (L->stacksize > LUAI_MAXSTACK)  /* was handling stack overflow? */
>   if (goodsize > LUAI_MAXSTACK)
>     goodsize = LUAI_MAXSTACK;  /* respect stack limit */
>   if (L->stacksize > LUAI_MAXSTACK)  /* had been handling stack overflow? */

229,233c230,236
<   if (inuse <= LUAI_MAXSTACK &&  /* not handling stack overflow? */
<       goodsize < L->stacksize)  /* trying to shrink? */
<     luaD_reallocstack(L, goodsize);  /* shrink it */
<   else
<     condmovestack(L,,);  /* don't change stack (change only for debugging) */
>   /* if thread is currently not handling a stack overflow and its
>      good size is smaller than current size, shrink its stack */
>   if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&
>       goodsize < L->stacksize)
>     luaD_reallocstack(L, goodsize);
>   else  /* don't change stack */
>     condmovestack(L,{},{});  /* (change only for debugging) */

324a328,393
> /*
> ** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'.
> ** Handle most typical cases (zero results for commands, one result for
> ** expressions, multiple results for tail calls/single parameters)
> ** separated.
> */
> static int moveresults (lua_State *L, const TValue *firstResult, StkId res,
>                                       int nres, int wanted) {
>   switch (wanted) {  /* handle typical cases separately */
>     case 0: break;  /* nothing to move */
>     case 1: {  /* one result needed */
>       if (nres == 0)   /* no results? */
>         firstResult = luaO_nilobject;  /* adjust with nil */
>       setobjs2s(L, res, firstResult);  /* move it to proper place */
>       break;
>     }
>     case LUA_MULTRET: {
>       int i;
>       for (i = 0; i < nres; i++)  /* move all results to correct place */
>         setobjs2s(L, res + i, firstResult + i);
>       L->top = res + nres;
>       return 0;  /* wanted == LUA_MULTRET */
>     }
>     default: {
>       int i;
>       if (wanted <= nres) {  /* enough results? */
>         for (i = 0; i < wanted; i++)  /* move wanted results to correct place */
>           setobjs2s(L, res + i, firstResult + i);
>       }
>       else {  /* not enough results; use all of them plus nils */
>         for (i = 0; i < nres; i++)  /* move all results to correct place */
>           setobjs2s(L, res + i, firstResult + i);
>         for (; i < wanted; i++)  /* complete wanted number of results */
>           setnilvalue(res + i);
>       }
>       break;
>     }
>   }
>   L->top = res + wanted;  /* top points after the last result */
>   return 1;
> }
> 
> 
> /*
> ** Finishes a function call: calls hook if necessary, removes CallInfo,
> ** moves current number of results to proper place; returns 0 iff call
> ** wanted multiple (variable number of) results.
> */
> int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) {
>   StkId res;
>   int wanted = ci->nresults;
>   if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
>     if (L->hookmask & LUA_MASKRET) {
>       ptrdiff_t fr = savestack(L, firstResult);  /* hook may change stack */
>       luaD_hook(L, LUA_HOOKRET, -1);
>       firstResult = restorestack(L, fr);
>     }
>     L->oldpc = ci->previous->u.l.savedpc;  /* 'oldpc' for caller function */
>   }
>   res = ci->func;  /* res == final position of 1st result */
>   L->ci = ci->previous;  /* back to caller */
>   /* move results to proper place */
>   return moveresults(L, firstResult, res, nres, wanted);
> }
> 
> 

377c446,448
<       if (p->is_vararg != 1) {  /* do not use vararg? */
>       if (p->is_vararg)
>         base = adjust_varargs(L, p, n);
>       else {  /* non vararg function */

382,383d452
<       else
<         base = adjust_varargs(L, p, n);

406,471d474
< ** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'.
< ** Handle most typical cases (zero results for commands, one result for
< ** expressions, multiple results for tail calls/single parameters)
< ** separated.
< */
< static int moveresults (lua_State *L, const TValue *firstResult, StkId res,
<                                       int nres, int wanted) {
<   switch (wanted) {  /* handle typical cases separately */
<     case 0: break;  /* nothing to move */
<     case 1: {  /* one result needed */
<       if (nres == 0)   /* no results? */
<         firstResult = luaO_nilobject;  /* adjust with nil */
<       setobjs2s(L, res, firstResult);  /* move it to proper place */
<       break;
<     }
<     case LUA_MULTRET: {
<       int i;
<       for (i = 0; i < nres; i++)  /* move all results to correct place */
<         setobjs2s(L, res + i, firstResult + i);
<       L->top = res + nres;
<       return 0;  /* wanted == LUA_MULTRET */
<     }
<     default: {
<       int i;
<       if (wanted <= nres) {  /* enough results? */
<         for (i = 0; i < wanted; i++)  /* move wanted results to correct place */
<           setobjs2s(L, res + i, firstResult + i);
<       }
<       else {  /* not enough results; use all of them plus nils */
<         for (i = 0; i < nres; i++)  /* move all results to correct place */
<           setobjs2s(L, res + i, firstResult + i);
<         for (; i < wanted; i++)  /* complete wanted number of results */
<           setnilvalue(res + i);
<       }
<       break;
<     }
<   }
<   L->top = res + wanted;  /* top points after the last result */
<   return 1;
< }
< 
< 
< /*
< ** Finishes a function call: calls hook if necessary, removes CallInfo,
< ** moves current number of results to proper place; returns 0 iff call
< ** wanted multiple (variable number of) results.
< */
< int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) {
<   StkId res;
<   int wanted = ci->nresults;
<   if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
<     if (L->hookmask & LUA_MASKRET) {
<       ptrdiff_t fr = savestack(L, firstResult);  /* hook may change stack */
<       luaD_hook(L, LUA_HOOKRET, -1);
<       firstResult = restorestack(L, fr);
<     }
<     L->oldpc = ci->previous->u.l.savedpc;  /* 'oldpc' for caller function */
<   }
<   res = ci->func;  /* res == final position of 1st result */
<   L->ci = ci->previous;  /* back to caller */
<   /* move results to proper place */
<   return moveresults(L, firstResult, res, nres, wanted);
< }
< 
< 
< /*

523,524c526,527
<     ci->callstatus &= ~CIST_YPCALL;  /* finish 'lua_pcall' */
<     L->errfunc = ci->u.c.old_errfunc;
>     ci->callstatus &= ~CIST_YPCALL;  /* continuation is also inside it */
>     L->errfunc = ci->u.c.old_errfunc;  /* with the same error function */

529d531
<   /* call continuation function */

531c533
<   n = (*ci->u.c.k)(L, status, ci->u.c.ctx);
>   n = (*ci->u.c.k)(L, status, ci->u.c.ctx);  /* call continuation function */

534,535c536
<   /* finish 'luaD_precall' */
<   luaD_poscall(L, ci, L->top - n, n);
>   luaD_poscall(L, ci, L->top - n, n);  /* finish 'luaD_precall' */

598,600c599,601
< ** signal an error in the call to 'resume', not in the execution of the
< ** coroutine itself. (Such errors should not be handled by any coroutine
< ** error handler and should not kill the coroutine.)
> ** Signal an error in the call to 'lua_resume', not in the execution
> ** of the coroutine itself. (Such errors should not be handled by any
> ** coroutine error handler and should not kill the coroutine.)

602,603c603,604
< static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) {
<   L->top = firstArg;  /* remove args from the stack */
> static int resume_error (lua_State *L, const char *msg, int narg) {
>   L->top -= narg;  /* remove args from the stack */

606c607,608
<   luaD_throw(L, -1);  /* jump back to 'lua_resume' */
>   lua_unlock(L);
>   return LUA_ERRRUN;

618d619
<   int nCcalls = L->nCcalls;

622,627c623
<   if (nCcalls >= LUAI_MAXCCALLS)
<     resume_error(L, "C stack overflow", firstArg);
<   if (L->status == LUA_OK) {  /* may be starting a coroutine */
<     if (ci != &L->base_ci)  /* not in base level? */
<       resume_error(L, "cannot resume non-suspended coroutine", firstArg);
<     /* coroutine is in base level; start running it */
>   if (L->status == LUA_OK) {  /* starting a coroutine? */

631,632d626
<   else if (L->status != LUA_YIELD)
<     resume_error(L, "cannot resume dead coroutine", firstArg);

633a628
>     lua_assert(L->status == LUA_YIELD);

650d644
<   lua_assert(nCcalls == L->nCcalls);

658c652,657
<   luai_userstateresume(L, nargs);
>   if (L->status == LUA_OK) {  /* may be starting a coroutine */
>     if (L->ci != &L->base_ci)  /* not in base level? */
>       return resume_error(L, "cannot resume non-suspended coroutine", nargs);
>   }
>   else if (L->status != LUA_YIELD)
>     return resume_error(L, "cannot resume dead coroutine", nargs);

659a659,661
>   if (L->nCcalls >= LUAI_MAXCCALLS)
>     return resume_error(L, "C stack overflow", nargs);
>   luai_userstateresume(L, nargs);

src/lgc.c

2c2
< ** $Id: lgc.c,v 2.212 2016/03/31 19:02:03 roberto Exp $
> ** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $

470c470
<                          sizeof(Node) * cast(size_t, sizenode(h));
>                          sizeof(Node) * cast(size_t, allocsizenode(h));

542c542
<     /* 'remarkupvals' may have removed thread from 'twups' list */ 
>     /* 'remarkupvals' may have removed thread from 'twups' list */

820a821
>     L->ci->callstatus |= CIST_FIN;  /* will run a finalizer */

821a823
>     L->ci->callstatus &= ~CIST_FIN;  /* not running a finalizer anymore */

src/linit.c

2c2
< ** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $
> ** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $

21c21
< **  luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
> **  luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);

24c24
< **  lua_pop(L, 1);  // remove _PRELOAD table
> **  lua_pop(L, 1);  // remove PRELOAD table

src/liolib.c

2c2
< ** $Id: liolib.c,v 2.149 2016/05/02 14:03:19 roberto Exp $
> ** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $

40,43c40,44
< #define l_checkmode(mode) \
< 	(*mode != '\0' && strchr("rwa", *(mode++)) != NULL &&	\
< 	(*mode != '+' || (++mode, 1)) &&  /* skip if char is '+' */	\
< 	(strspn(mode, L_MODEEXT) == strlen(mode)))
> static int l_checkmode (const char *mode) {
>   return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL &&
>          (*mode != '+' || (++mode, 1)) &&  /* skip if char is '+' */
>          (strspn(mode, L_MODEEXT) == strlen(mode)));  /* check extensions */
> }

621,622c622,625
<                 ? fprintf(f, LUA_INTEGER_FMT, lua_tointeger(L, arg))
<                 : fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg));
>                 ? fprintf(f, LUA_INTEGER_FMT,
>                              (LUAI_UACINT)lua_tointeger(L, arg))
>                 : fprintf(f, LUA_NUMBER_FMT,
>                              (LUAI_UACNUMBER)lua_tonumber(L, arg));

src/lmathlib.c

2c2
< ** $Id: lmathlib.c,v 1.117 2015/10/02 15:39:23 roberto Exp $
> ** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $

187c187,188
<     if (base == 2.0) res = l_mathop(log2)(x); else
>     if (base == l_mathop(2.0))
>       res = l_mathop(log2)(x); else

189,190c190,193
<     if (base == 10.0) res = l_mathop(log10)(x);
<     else res = l_mathop(log)(x)/l_mathop(log)(base);
>     if (base == l_mathop(10.0))
>       res = l_mathop(log10)(x);
>     else
>       res = l_mathop(log)(x)/l_mathop(log)(base);

265c268
<   luaL_argcheck(L, low <= up, 1, "interval is empty"); 
>   luaL_argcheck(L, low <= up, 1, "interval is empty");

284c287
<         lua_pushliteral(L, "integer"); 
>         lua_pushliteral(L, "integer");

286c289
<         lua_pushliteral(L, "float"); 
>         lua_pushliteral(L, "float");

src/loadlib.c

2c2
< ** $Id: loadlib.c,v 1.127 2015/11/23 11:30:45 roberto Exp $
> ** $Id: loadlib.c,v 1.129 2016/12/04 20:17:24 roberto Exp $

28,49d27
< ** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment
< ** variables that Lua check to set its paths.
< */
< #if !defined(LUA_PATH_VAR)
< #define LUA_PATH_VAR	"LUA_PATH"
< #endif
< 
< #if !defined(LUA_CPATH_VAR)
< #define LUA_CPATH_VAR	"LUA_CPATH"
< #endif
< 
< #define LUA_PATHSUFFIX		"_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
< 
< #define LUA_PATHVARVERSION		LUA_PATH_VAR LUA_PATHSUFFIX
< #define LUA_CPATHVARVERSION		LUA_CPATH_VAR LUA_PATHSUFFIX
< 
< /*
< ** LUA_PATH_SEP is the character that separates templates in a path.
< ** LUA_PATH_MARK is the string that marks the substitution points in a
< ** template.
< ** LUA_EXEC_DIR in a Windows path is replaced by the executable's
< ** directory.

53,61d30
< #if !defined (LUA_PATH_SEP)
< #define LUA_PATH_SEP		";"
< #endif
< #if !defined (LUA_PATH_MARK)
< #define LUA_PATH_MARK		"?"
< #endif
< #if !defined (LUA_EXEC_DIR)
< #define LUA_EXEC_DIR		"!"
< #endif

97,98d65
< #define setprogdir(L)		((void)0)
< 

182d148
< #undef setprogdir

192,206d157
< static void setprogdir (lua_State *L) {
<   char buff[MAX_PATH + 1];
<   char *lb;
<   DWORD nsize = sizeof(buff)/sizeof(char);
<   DWORD n = GetModuleFileNameA(NULL, buff, nsize);
<   if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
<     luaL_error(L, "unable to get ModuleFileName");
<   else {
<     *lb = '\0';
<     luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff);
<     lua_remove(L, -2);  /* remove original string */
<   }
< }
< 
< 

523c474
<   lua_getfield(L, LUA_REGISTRYINDEX, "_PRELOAD");
>   lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);

560,562c511,513
<   lua_settop(L, 1);  /* _LOADED table will be at index 2 */
<   lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
<   lua_getfield(L, 2, name);  /* _LOADED[name] */
>   lua_settop(L, 1);  /* LOADED table will be at index 2 */
>   lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
>   lua_getfield(L, 2, name);  /* LOADED[name] */

572c523
<     lua_setfield(L, 2, name);  /* _LOADED[name] = returned value */
>     lua_setfield(L, 2, name);  /* LOADED[name] = returned value */

576c527
<     lua_setfield(L, 2, name);  /* _LOADED[name] = true */
>     lua_setfield(L, 2, name);  /* LOADED[name] = true */

669,703d619
< /* auxiliary mark (for internal use) */
< #define AUXMARK		"\1"
< 
< 
< /*
< ** return registry.LUA_NOENV as a boolean
< */
< static int noenv (lua_State *L) {
<   int b;
<   lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
<   b = lua_toboolean(L, -1);
<   lua_pop(L, 1);  /* remove value */
<   return b;
< }
< 
< 
< static void setpath (lua_State *L, const char *fieldname, const char *envname1,
<                                    const char *envname2, const char *def) {
<   const char *path = getenv(envname1);
<   if (path == NULL)  /* no environment variable? */
<     path = getenv(envname2);  /* try alternative name */
<   if (path == NULL || noenv(L))  /* no environment variable? */
<     lua_pushstring(L, def);  /* use default */
<   else {
<     /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
<     path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
<                               LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
<     luaL_gsub(L, path, AUXMARK, def);
<     lua_remove(L, -2);
<   }
<   setprogdir(L);
<   lua_setfield(L, -2, fieldname);
< }
< 
< 

767,770c683,686
<   /* set field 'path' */
<   setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT);
<   /* set field 'cpath' */
<   setpath(L, "cpath", LUA_CPATHVARVERSION, LUA_CPATH_VAR, LUA_CPATH_DEFAULT);
>   lua_pushstring(L, LUA_PATH_DEFAULT);
>   lua_setfield(L, -2, "path");  /* package.path = default path */
>   lua_pushstring(L, LUA_CPATH_DEFAULT);
>   lua_setfield(L, -2, "cpath");  /* package.cpath = default cpath */

776c692
<   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
>   luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);

779c695
<   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
>   luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);

src/lobject.c

2c2
< ** $Id: lobject.c,v 2.111 2016/05/20 14:07:48 roberto Exp $
> ** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $

283c283
<     char *pdot = strchr(s, '.');
>     const char *pdot = strchr(s, '.');

397c397
< ** this function handles only '%d', '%c', '%f', '%p', and '%s' 
> ** this function handles only '%d', '%c', '%f', '%p', and '%s'

src/lobject.h

2c2
< ** $Id: lobject.h,v 2.116 2015/11/03 18:33:10 roberto Exp $
> ** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $

410c410
<   lu_byte is_vararg;  /* 2: declared vararg; 1: uses vararg */
>   lu_byte is_vararg;

src/lopcodes.h

2c2
< ** $Id: lopcodes.h,v 1.148 2014/10/25 11:50:46 roberto Exp $
> ** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $

141a142
> #if !defined(MAXINDEXRK)  /* (for debugging only) */

142a144
> #endif

src/loslib.c

2c2
< ** $Id: loslib.c,v 1.64 2016/04/18 13:06:55 roberto Exp $
> ** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $

33c33
< /* options for ANSI C 89 */
> /* options for ANSI C 89 (only 1-char options) */

38c38
< 	"||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy"
>     "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy"  /* two-char options */

42c42
< 	"||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y"
>     "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y"  /* two-char options */

260,263c260,264
< static const char *checkoption (lua_State *L, const char *conv, char *buff) {
<   const char *option;
<   int oplen = 1;
<   for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) {
> static const char *checkoption (lua_State *L, const char *conv,
>                                 ptrdiff_t convlen, char *buff) {
>   const char *option = LUA_STRFTIMEOPTIONS;
>   int oplen = 1;  /* length of options being checked */
>   for (; *option != '\0' && oplen <= convlen; option += oplen) {

265c266
<       oplen++;  /* next length */
>       oplen++;  /* will check options with next length (+1) */

283c284,285
<   const char *s = luaL_optstring(L, 1, "%c");
>   size_t slen;
>   const char *s = luaL_optlstring(L, 1, "%c", &slen);

284a287
>   const char *se = s + slen;  /* 's' end */

303c306
<     while (*s) {
>     while (s < se) {

309c312,313
<         s = checkoption(L, s + 1, cc + 1);  /* copy specifier to 'cc' */
>         s++;  /* skip '%' */
>         s = checkoption(L, s, se - s, cc + 1);  /* copy specifier to 'cc' */

src/lparser.c

2c2
< ** $Id: lparser.c,v 2.153 2016/05/13 19:10:16 roberto Exp $
> ** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $

325a326,327
>   if (nexps > nvars)
>     ls->fs->freereg -= nexps - nvars;  /* remove extra values */

767c769
<           f->is_vararg = 2;  /* declared vararg */
>           f->is_vararg = 1;  /* declared vararg */

963d964
<       fs->f->is_vararg = 1;  /* function actually uses vararg */

1163c1164
<     if (nexps != nvars) {
>     if (nexps != nvars)

1165,1167d1165
<       if (nexps > nvars)
<         ls->fs->freereg -= nexps - nvars;  /* remove extra values */
<     }

1618c1616
<   fs->f->is_vararg = 2;  /* main function is always declared vararg */
>   fs->f->is_vararg = 1;  /* main function is always declared vararg */

src/lstate.h

2c2
< ** $Id: lstate.h,v 2.130 2015/12/16 16:39:38 roberto Exp $
> ** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $

26c26
< ** 'tobefnz': all objects ready to be finalized; 
> ** 'tobefnz': all objects ready to be finalized;

37c37
< ** Atomic type (relative to signals) to better ensure that 'lua_sethook' 
> ** Atomic type (relative to signals) to better ensure that 'lua_sethook'

69c69
< ** case, the actual 'func' value is saved in field 'extra'. 
> ** case, the actual 'func' value is saved in field 'extra'.

91c91
<   lu_byte callstatus;
>   unsigned short callstatus;

106a107
> #define CIST_FIN	(1<<8)  /* call is running a finalizer */

src/lstrlib.c

2c2
< ** $Id: lstrlib.c,v 1.251 2016/05/20 14:13:21 roberto Exp $
> ** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $

842,843c842,844
<   if (x != x || x == HUGE_VAL || x == -HUGE_VAL)  /* inf or NaN? */
<     return l_sprintf(buff, sz, LUA_NUMBER_FMT, x);  /* equal to '%g' */
>   /* if 'inf' or 'NaN', format it like '%g' */
>   if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL)
>     return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x);

846c847
<     return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", x);
>     return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x);

936c937
<     char *ppoint = memchr(buff, point, nb);
>     char *ppoint = (char *)memchr(buff, point, nb);

963c964
<         nb = l_sprintf(buff, MAX_ITEM, format, n);
>         nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n);

1044c1045
<           nb = l_sprintf(buff, MAX_ITEM, form, n);
>           nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACINT)n);

1053a1055
>           lua_Number n = luaL_checknumber(L, arg);

1055c1057
<           nb = l_sprintf(buff, MAX_ITEM, form, luaL_checknumber(L, arg));
>           nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACNUMBER)n);

1262c1264
< ** always gets its full alignment, other options are limited by 
> ** always gets its full alignment, other options are limited by

src/ltable.c

2c2
< ** $Id: ltable.c,v 2.117 2015/11/19 19:16:22 roberto Exp $
> ** $Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp $

77,78d76
< #define isdummy(n)		((n) == dummynode)
< 

311d308
<   int lsize;

314c311,312
<     lsize = 0;
>     t->lsizenode = 0;
>     t->lastfree = NULL;  /* signal that it is using dummy node */

318c316
<     lsize = luaO_ceillog2(size);
>     int lsize = luaO_ceillog2(size);

328a327,328
>     t->lsizenode = cast_byte(lsize);
>     t->lastfree = gnode(t, size);  /* all positions are free */

330,331d329
<   t->lsizenode = cast_byte(lsize);
<   t->lastfree = gnode(t, size);  /* all positions are free */

340c338
<   int oldhsize = t->lsizenode;
>   int oldhsize = allocsizenode(t);

357c355
<   for (j = twoto(oldhsize) - 1; j >= 0; j--) {
>   for (j = oldhsize - 1; j >= 0; j--) {

365,366c363,364
<   if (!isdummy(nold))
<     luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old hash */
>   if (oldhsize > 0)  /* not the dummy node? */
>     luaM_freearray(L, nold, cast(size_t, oldhsize)); /* free old hash */

371c369
<   int nsize = isdummy(t->node) ? 0 : sizenode(t);
>   int nsize = allocsizenode(t);

417c415
<   if (!isdummy(t->node))
>   if (!isdummy(t))

425,428c423,428
<   while (t->lastfree > t->node) {
<     t->lastfree--;
<     if (ttisnil(gkey(t->lastfree)))
<       return t->lastfree;
>   if (!isdummy(t)) {
>     while (t->lastfree > t->node) {
>       t->lastfree--;
>       if (ttisnil(gkey(t->lastfree)))
>         return t->lastfree;
>     }

448c448
<     if (luaV_tointeger(key, &k, 0)) {  /* index is int? */
>     if (luaV_tointeger(key, &k, 0)) {  /* does index fit in an integer? */

456c456
<   if (!ttisnil(gval(mp)) || isdummy(mp)) {  /* main position is taken? */
>   if (!ttisnil(gval(mp)) || isdummy(t)) {  /* main position is taken? */

464c464
<     lua_assert(!isdummy(f));
>     lua_assert(!isdummy(t));

654c654
<   else if (isdummy(t->node))  /* hash part is empty? */
>   else if (isdummy(t))  /* hash part is empty? */

667c667
< int luaH_isdummy (Node *n) { return isdummy(n); }
> int luaH_isdummy (const Table *t) { return isdummy(t); }

src/ltable.h

2c2
< ** $Id: ltable.h,v 2.21 2015/11/03 15:47:30 roberto Exp $
> ** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp $

18c18
< /* 'const' to avoid wrong writings that can mess up field 'next' */ 
> /* 'const' to avoid wrong writings that can mess up field 'next' */

29a30,37
> /* true when 't' is using 'dummynode' as its hash part */
> #define isdummy(t)		((t)->lastfree == NULL)
> 
> 
> /* allocated size for hash nodes */
> #define allocsizenode(t)	(isdummy(t) ? 0 : sizenode(t))
> 
> 

54c62
< LUAI_FUNC int luaH_isdummy (Node *n);
> LUAI_FUNC int luaH_isdummy (const Table *t);

src/ltm.c

2c2
< ** $Id: ltm.c,v 2.37 2016/02/26 19:20:15 roberto Exp $
> ** $Id: ltm.c,v 2.38 2016/12/22 13:08:50 roberto Exp $

18c18
< #include "ldo.h" 
> #include "ldo.h"

src/lua.c

2c2
< ** $Id: lua.c,v 1.226 2015/08/14 19:11:20 roberto Exp $
> ** $Id: lua.c,v 1.229 2016/12/22 13:08:50 roberto Exp $

22a23,25
> #define LUA_VERSUFFIX          "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
> 
> 

40,41c43
< #define LUA_INITVARVERSION  \
< 	LUA_INIT_VAR "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
> #define LUA_INITVARVERSION	LUA_INIT_VAR LUA_VERSUFFIX

57a60,61
> #include <windows.h>
> 

460c464
< ** any invalid argument). 'first' returns the first not-handled argument 
> ** any invalid argument). 'first' returns the first not-handled argument

484c488
<         args |= has_i;  /* (-i implies -v) *//* FALLTHROUGH */ 
>         args |= has_i;  /* (-i implies -v) *//* FALLTHROUGH */

531a536,618
> 
> /*
> ** {==================================================================
> ** Set Paths
> ** ===================================================================
> */
> 
> /*
> ** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment
> ** variables that Lua check to set its paths.
> */
> #if !defined(LUA_PATH_VAR)
> #define LUA_PATH_VAR    "LUA_PATH"
> #endif
> 
> #if !defined(LUA_CPATH_VAR)
> #define LUA_CPATH_VAR   "LUA_CPATH"
> #endif
> 
> #define LUA_PATHVARVERSION              LUA_PATH_VAR LUA_VERSUFFIX
> #define LUA_CPATHVARVERSION             LUA_CPATH_VAR LUA_VERSUFFIX
> 
> 
> #define AUXMARK         "\1"	/* auxiliary mark */
> 
> 
> #if defined(LUA_USE_WINDOWS)
> 
> 
> /*
> ** Replace in the path (on the top of the stack) any occurrence
> ** of LUA_EXEC_DIR with the executable's path.
> */
> static void setprogdir (lua_State *L) {
>   char buff[MAX_PATH + 1];
>   char *lb;
>   DWORD nsize = sizeof(buff)/sizeof(char);
>   DWORD n = GetModuleFileNameA(NULL, buff, nsize);  /* get exec. name */
>   if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
>     luaL_error(L, "unable to get ModuleFileName");
>   else {
>     *lb = '\0';  /* cut name on the last '\\' to get the path */
>     luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff);
>     lua_remove(L, -2);  /* remove original string */
>   }
> }
> 
> #else
> 
> #define setprogdir(L)           ((void)0)
> 
> #endif
> 
> /*
> ** Change a path according to corresponding environment variables
> */
> static void chgpath (lua_State *L, const char *fieldname,
>                                    const char *envname1,
>                                    const char *envname2,
>                                    int noenv) {
>   const char *path = getenv(envname1);
>   lua_getglobal(L, LUA_LOADLIBNAME);  /* get 'package' table */
>   lua_getfield(L, -1, fieldname);  /* get original path */
>   if (path == NULL)  /* no environment variable? */
>     path = getenv(envname2);  /* try alternative name */
>   if (path == NULL || noenv)  /* no environment variable? */
>     lua_pushvalue(L, -1);  /* use original value */
>   else {
>     const char *def = lua_tostring(L, -1);  /* default path */
>     /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
>     path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
>                               LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
>     luaL_gsub(L, path, AUXMARK, def);
>     lua_remove(L, -2); /* remove result from 1st 'gsub' */
>   }
>   setprogdir(L);
>   lua_setfield(L, -3, fieldname);  /* set path value */
>   lua_pop(L, 2);  /* pop 'package' table and original path  */
> }
> 
> /* }================================================================== */
> 
> 

564,567d650
<   if (args & has_E) {  /* option '-E'? */
<     lua_pushboolean(L, 1);  /* signal for libraries to ignore env. vars. */
<     lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
<   }

568a652,654
>   /* change paths according to env variables */
>   chgpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, (args & has_E));
>   chgpath(L, "cpath", LUA_CPATHVARVERSION, LUA_CPATH_VAR, (args & has_E));

src/lua.h

2c2
< ** $Id: lua.h,v 1.331 2016/05/30 15:53:28 roberto Exp $
> ** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp $

22c22
< #define LUA_VERSION_RELEASE	"3"
> #define LUA_VERSION_RELEASE	"4"

26c26
< #define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2016 Lua.org, PUC-Rio"
> #define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2017 Lua.org, PUC-Rio"

463c463
< * Copyright (C) 1994-2016 Lua.org, PUC-Rio.
> * Copyright (C) 1994-2017 Lua.org, PUC-Rio.

src/luaconf.h

2c2
< ** $Id: luaconf.h,v 1.255 2016/05/01 20:06:09 roberto Exp $
> ** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $

161a162,173
> ** LUA_PATH_SEP is the character that separates templates in a path.
> ** LUA_PATH_MARK is the string that marks the substitution points in a
> ** template.
> ** LUA_EXEC_DIR in a Windows path is replaced by the executable's
> ** directory.
> */
> #define LUA_PATH_SEP            ";"
> #define LUA_PATH_MARK           "?"
> #define LUA_EXEC_DIR            "!"
> 
> 
> /*

407c419
< @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
> @@ LUAI_UACNUMBER is the result of a 'default argument promotion'

424c436,437
< #define lua_number2str(s,sz,n)	l_sprintf((s), sz, LUA_NUMBER_FMT, (n))
> #define lua_number2str(s,sz,n)  \
> 	l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))

501c514
< @@ LUAI_UACINT is the result of an 'usual argument conversion'
> @@ LUAI_UACINT is the result of a 'default argument promotion'

514d526
< #define lua_integer2str(s,sz,n)	l_sprintf((s), sz, LUA_INTEGER_FMT, (n))

517a530,532
> #define lua_integer2str(s,sz,n)  \
> 	l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
> 

609c624
< @@ lua_number2strx converts a float to an hexadecimal numeric string. 
> @@ lua_number2strx converts a float to an hexadecimal numeric string.

615c630,631
< #define lua_number2strx(L,b,sz,f,n)	((void)L, l_sprintf(b,sz,f,n))
> #define lua_number2strx(L,b,sz,f,n)  \
> 	((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))

731c747
< ** 'string.format("%.99f", 1e4932)' needs ~5030 bytes, so a
> ** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a

735c751
< #if defined(LUA_FLOAT_LONGDOUBLE)
> #if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE

src/lutf8lib.c

2c2
< ** $Id: lutf8lib.c,v 1.15 2015/03/28 19:16:55 roberto Exp $
> ** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp $

197c197
<   return 1;  
>   return 1;

src/lvm.h

2c2
< ** $Id: lvm.h,v 2.40 2016/01/05 16:07:21 roberto Exp $
> ** $Id: lvm.h,v 2.41 2016/12/22 13:08:50 roberto Exp $

93c93
<   
>