Unified · Split
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | This is Lua 5.3.0, released on 11 Dec 2014. | 2 | This is Lua 5.3.0, released on 16 Dec 2014. |
| 3 | 3 | ||
| 4 | For installation instructions, license details, and | 4 | For installation instructions, license details, and |
| 5 | further information about Lua, see doc/readme.html. | 5 | further information about Lua, see doc/readme.html. |
| @@ -33,7 +33,7 @@ Freely available under the terms of the · 32 unmodified lines | |||
| 33 | <!-- ====================================================================== --> | 33 | <!-- ====================================================================== --> |
| 34 | <p> | 34 | <p> |
| 35 | 35 | ||
| 36 | <!-- $Id: manual.of,v 1.140 2014/12/10 11:58:42 roberto Exp $ --> | 36 | <!-- $Id: manual.of,v 1.141 2014/12/16 16:21:31 roberto Exp $ --> |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -143,9 +143,9 @@ Standard Lua uses 64-bit integers and double-precision (64-bit) floats, · 103 unmodified lines | |||
| 143 | but you can also compile Lua so that it | 143 | but you can also compile Lua so that it |
| 144 | uses 32-bit integers and/or single-precision (32-bit) floats. | 144 | uses 32-bit integers and/or single-precision (32-bit) floats. |
| 145 | The option with 32 bits for both integers and floats | 145 | The option with 32 bits for both integers and floats |
| 146 | (called <em>Small Lua</em>) is particularly attractive | 146 | is particularly attractive |
| 147 | for small machines and embedded systems. | 147 | for small machines and embedded systems. |
| 148 | (See <code>LUA_INT</code> in file <code>luaconf.h</code>.) | 148 | (See macro <code>LUA_32BITS</code> in file <code>luaconf.h</code>.) |
| 149 | 149 | ||
| 150 | 150 | ||
| 151 | <p> | 151 | <p> |
| @@ -1903,7 +1903,7 @@ Lua supports the following bitwise operators: · 1751 unmodified lines | |||
| 1903 | 1903 | ||
| 1904 | <ul> | 1904 | <ul> |
| 1905 | <li><b><code>&</code>: </b>bitwise and</li> | 1905 | <li><b><code>&</code>: </b>bitwise and</li> |
| 1906 | <li><b><code>|</code>: </b>bitwise or</li> | 1906 | <li><b><code>|</code>: </b>bitwise or</li> |
| 1907 | <li><b><code>~</code>: </b>bitwise exclusive or</li> | 1907 | <li><b><code>~</code>: </b>bitwise exclusive or</li> |
| 1908 | <li><b><code>>></code>: </b>right shift</li> | 1908 | <li><b><code>>></code>: </b>right shift</li> |
| 1909 | <li><b><code><<</code>: </b>left shift</li> | 1909 | <li><b><code><<</code>: </b>left shift</li> |
| @@ -3094,7 +3094,7 @@ The value of <code>op</code> must be one of the following constants: · 1184 unmodified lines | |||
| 3094 | <li><b><a name="pdf-LUA_OPUNM"><code>LUA_OPUNM</code></a>: </b> performs mathematical negation (unary <code>-</code>)</li> | 3094 | <li><b><a name="pdf-LUA_OPUNM"><code>LUA_OPUNM</code></a>: </b> performs mathematical negation (unary <code>-</code>)</li> |
| 3095 | <li><b><a name="pdf-LUA_OPBNOT"><code>LUA_OPBNOT</code></a>: </b> performs bitwise negation (<code>~</code>)</li> | 3095 | <li><b><a name="pdf-LUA_OPBNOT"><code>LUA_OPBNOT</code></a>: </b> performs bitwise negation (<code>~</code>)</li> |
| 3096 | <li><b><a name="pdf-LUA_OPBAND"><code>LUA_OPBAND</code></a>: </b> performs bitwise and (<code>&</code>)</li> | 3096 | <li><b><a name="pdf-LUA_OPBAND"><code>LUA_OPBAND</code></a>: </b> performs bitwise and (<code>&</code>)</li> |
| 3097 | <li><b><a name="pdf-LUA_OPBOR"><code>LUA_OPBOR</code></a>| performs bitwise or (<code>: </b></code>)</li> | 3097 | <li><b><a name="pdf-LUA_OPBOR"><code>LUA_OPBOR</code></a>: </b> performs bitwise or (<code>|</code>)</li> |
| 3098 | <li><b><a name="pdf-LUA_OPBXOR"><code>LUA_OPBXOR</code></a>: </b> performs bitwise exclusive or (<code>~</code>)</li> | 3098 | <li><b><a name="pdf-LUA_OPBXOR"><code>LUA_OPBXOR</code></a>: </b> performs bitwise exclusive or (<code>~</code>)</li> |
| 3099 | <li><b><a name="pdf-LUA_OPSHL"><code>LUA_OPSHL</code></a>: </b> performs left shift (<code><<</code>)</li> | 3099 | <li><b><a name="pdf-LUA_OPSHL"><code>LUA_OPSHL</code></a>: </b> performs left shift (<code><<</code>)</li> |
| 3100 | <li><b><a name="pdf-LUA_OPSHR"><code>LUA_OPSHR</code></a>: </b> performs right shift (<code>>></code>)</li> | 3100 | <li><b><a name="pdf-LUA_OPSHR"><code>LUA_OPSHR</code></a>: </b> performs right shift (<code>>></code>)</li> |
| @@ -7219,9 +7219,9 @@ so that the construction · 4118 unmodified lines | |||
| 7219 | <pre> | 7219 | <pre> |
| 7220 | for i,v in ipairs(t) do <em>body</em> end | 7220 | for i,v in ipairs(t) do <em>body</em> end |
| 7221 | </pre><p> | 7221 | </pre><p> |
| 7222 | will iterate over the pairs | 7222 | will iterate over the key–value pairs |
| 7223 | (<code>1,t[1]</code>), (<code>2,t[2]</code>), ..., | 7223 | (<code>1,t[1]</code>), (<code>2,t[2]</code>), ..., |
| 7224 | up to the first integer key absent from the table. | 7224 | up to the first nil value. |
| 7225 | 7225 | ||
| 7226 | 7226 | ||
| 7227 | 7227 | ||
| @@ -10588,7 +10588,7 @@ The <code>bit32</code> library has been deprecated. · 3360 unmodified lines | |||
| 10588 | It is easy to require a compatible external library or, | 10588 | It is easy to require a compatible external library or, |
| 10589 | better yet, to replace its functions with appropriate bitwise operations. | 10589 | better yet, to replace its functions with appropriate bitwise operations. |
| 10590 | (Keep in mind that <code>bit32</code> operates on 32-bit integers, | 10590 | (Keep in mind that <code>bit32</code> operates on 32-bit integers, |
| 10591 | while the bitwise operators in Standard Lua operate on 64-bit integers.) | 10591 | while the bitwise operators in standard Lua operate on 64-bit integers.) |
| 10592 | </li> | 10592 | </li> |
| 10593 | 10593 | ||
| 10594 | <li> | 10594 | <li> |
| @@ -10768,7 +10768,7 @@ and LiteralString, see <a href="#3.1">§3.1</a>.) · 173 unmodified lines | |||
| 10768 | <HR> | 10768 | <HR> |
| 10769 | <SMALL CLASS="footer"> | 10769 | <SMALL CLASS="footer"> |
| 10770 | Last update: | 10770 | Last update: |
| 10771 | Wed Dec 10 15:49:17 BRST 2014 | 10771 | Tue Dec 16 14:45:50 BRST 2014 |
| 10772 | </SMALL> | 10772 | </SMALL> |
| 10773 | <!-- | 10773 | <!-- |
| 10774 | Last change: revised for Lua 5.3.0 (final) | 10774 | Last change: revised for Lua 5.3.0 (final) |
| @@ -251,6 +251,7 @@ compiler: · 250 unmodified lines | |||
| 251 | be linked statically into the host program and its symbols exported for | 251 | be linked statically into the host program and its symbols exported for |
| 252 | dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter. | 252 | dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter. |
| 253 | For Windows, we recommend that the Lua library be a DLL. | 253 | For Windows, we recommend that the Lua library be a DLL. |
| 254 | In all cases, the compiler luac should be linked statically. | ||
| 254 | 255 | ||
| 255 | <P> | 256 | <P> |
| 256 | As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize | 257 | As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize |
| @@ -268,9 +269,10 @@ lists the · 11 unmodified lines | |||
| 268 | <H3>Main changes</H3> | 269 | <H3>Main changes</H3> |
| 269 | <UL> | 270 | <UL> |
| 270 | <LI> integers (64-bit by default) | 271 | <LI> integers (64-bit by default) |
| 271 | <LI> official support for small architectures ("Small Lua" with 32-bit numbers) | 272 | <LI> official support for 32-bit numbers |
| 272 | <LI> bitwise operators | 273 | <LI> bitwise operators |
| 273 | <LI> basic utf-8 support | 274 | <LI> basic utf-8 support |
| 275 | <LI> functions for packing and unpacking values | ||
| 274 | 276 | ||
| 275 | </UL> | 277 | </UL> |
| 276 | 278 | ||
| @@ -280,30 +282,30 @@ Here are the other changes introduced in Lua 5.3: · 3 unmodified lines | |||
| 280 | <LI> userdata can have any Lua value as uservalue | 282 | <LI> userdata can have any Lua value as uservalue |
| 281 | <LI> integer division | 283 | <LI> integer division |
| 282 | <LI> more flexible rules for some metamethods | 284 | <LI> more flexible rules for some metamethods |
| 283 | <LI> utf-8 escapes in literal strings | ||
| 284 | </UL> | 285 | </UL> |
| 285 | 286 | ||
| 286 | <H3>Libraries</H3> | 287 | <H3>Libraries</H3> |
| 287 | <UL> | 288 | <UL> |
| 288 | <LI> basic utf-8 library | ||
| 289 | <LI> <CODE>ipairs</CODE> and the table library respect metamethods | 289 | <LI> <CODE>ipairs</CODE> and the table library respect metamethods |
| 290 | <LI> functions for packing and unpacking values | ||
| 291 | <LI> strip option in <CODE>string.dump</CODE> | 290 | <LI> strip option in <CODE>string.dump</CODE> |
| 292 | <LI> table library respects metamethods | 291 | <LI> table library respects metamethods |
| 293 | <LI> new function <CODE>table.move</CODE> | 292 | <LI> new function <CODE>table.move</CODE> |
| 293 | <LI> new function <CODE>string.pack</CODE> | ||
| 294 | <LI> new function <CODE>string.unpack</CODE> | ||
| 295 | <LI> new function <CODE>string.packsize</CODE> | ||
| 294 | </UL> | 296 | </UL> |
| 295 | 297 | ||
| 296 | <H3>C API</H3> | 298 | <H3>C API</H3> |
| 297 | <UL> | 299 | <UL> |
| 298 | <LI> simpler API for continuation functions in C | 300 | <LI> simpler API for continuation functions in C |
| 299 | <LI> new functions: | ||
| 300 | <CODE>lua_rotate</CODE>, | ||
| 301 | <CODE>lua_isyieldable</CODE>, | ||
| 302 | <CODE>lua_stringtonumber</CODE>, | ||
| 303 | <CODE>lua_geti</CODE>, | ||
| 304 | <CODE>lua_seti</CODE> | ||
| 305 | <LI> <CODE>lua_gettable</CODE> and similar functions return type of resulted value | 301 | <LI> <CODE>lua_gettable</CODE> and similar functions return type of resulted value |
| 306 | <LI> strip option in <CODE>lua_dump</CODE> | 302 | <LI> strip option in <CODE>lua_dump</CODE> |
| 303 | <LI> new function: <CODE>lua_geti</CODE> | ||
| 304 | <LI> new function: <CODE>lua_seti</CODE> | ||
| 305 | <LI> new function: <CODE>lua_isyieldable</CODE> | ||
| 306 | <LI> new function: <CODE>lua_numbertointeger</CODE> | ||
| 307 | <LI> new function: <CODE>lua_rotate</CODE> | ||
| 308 | <LI> new function: <CODE>lua_stringtonumber</CODE> | ||
| 307 | </UL> | 309 | </UL> |
| 308 | 310 | ||
| 309 | <H3>Lua standalone interpreter</H3> | 311 | <H3>Lua standalone interpreter</H3> |
| @@ -359,7 +361,7 @@ THE SOFTWARE. · 49 unmodified lines | |||
| 359 | <HR> | 361 | <HR> |
| 360 | <SMALL CLASS="footer"> | 362 | <SMALL CLASS="footer"> |
| 361 | Last update: | 363 | Last update: |
| 362 | Tue Dec 9 21:16:03 BRST 2014 | 364 | Fri Dec 12 09:58:42 BRST 2014 |
| 363 | </SMALL> | 365 | </SMALL> |
| 364 | <!-- | 366 | <!-- |
| 365 | Last change: updated for Lua 5.3.0 (final) | 367 | Last change: updated for Lua 5.3.0 (final) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.277 2014/12/10 11:31:32 roberto Exp $ | 2 | ** $Id: lauxlib.c,v 1.279 2014/12/14 18:32:26 roberto Exp $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -66,11 +66,20 @@ static int findfield (lua_State *L, int objidx, int level) { · 60 unmodified lines | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | /* | ||
| 70 | ** Search for a name for a function in all loaded modules | ||
| 71 | ** (registry._LOADED). | ||
| 72 | */ | ||
| 69 | static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { | 73 | static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { |
| 70 | int top = lua_gettop(L); | 74 | int top = lua_gettop(L); |
| 71 | lua_getinfo(L, "f", ar); /* push function */ | 75 | lua_getinfo(L, "f", ar); /* push function */ |
| 72 | lua_pushglobaltable(L); | 76 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); |
| 73 | if (findfield(L, top + 1, 2)) { | 77 | if (findfield(L, top + 1, 2)) { |
| 78 | const char *name = lua_tostring(L, -1); | ||
| 79 | if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ | ||
| 80 | lua_pushstring(L, name + 3); /* push name without prefix */ | ||
| 81 | lua_remove(L, -2); /* remove original name */ | ||
| 82 | } | ||
| 74 | lua_copy(L, -1, top + 1); /* move name to proper place */ | 83 | lua_copy(L, -1, top + 1); /* move name to proper place */ |
| 75 | lua_pop(L, 2); /* remove pushed values */ | 84 | lua_pop(L, 2); /* remove pushed values */ |
| 76 | return 1; | 85 | return 1; |
| @@ -1,12 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.231 2014/12/10 11:56:55 roberto Exp $ | 2 | ** $Id: luaconf.h,v 1.235 2014/12/16 17:17:30 roberto Exp $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | #ifndef lconfig_h | 8 | #ifndef luaconf_h |
| 9 | #define lconfig_h | 9 | #define luaconf_h |
| 10 | 10 | ||
| 11 | #include <limits.h> | 11 | #include <limits.h> |
| 12 | #include <stddef.h> | 12 | #include <stddef.h> |
| @@ -20,18 +20,18 @@ · 7 unmodified lines | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | ** {================================================================== | 23 | ** {==================================================================== |
| 24 | ** System Configuration: macros to adapt (if needed) Lua to some | 24 | ** System Configuration: macros to adapt (if needed) Lua to some |
| 25 | ** particular platform, for instance compiling it as Small Lua (32 | 25 | ** particular platform, for instance compiling it with 32-bit numbers or |
| 26 | ** bits) or restricting it to C89. | 26 | ** restricting it to C89. |
| 27 | ** =================================================================== | 27 | ** ===================================================================== |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | @@ LUA_32BITS enables Small Lua (that is, Lua with 32-bit integers | 31 | @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You |
| 32 | ** and 32-bit floats). You can also define LUA_32BITS in the make file, | 32 | ** can also define LUA_32BITS in the make file, but changing here you |
| 33 | ** but changing here you ensure that all software connected to Lua will | 33 | ** ensure that all software connected to Lua will be compiled with the |
| 34 | ** be compiled with the same configuration. | 34 | ** same configuration. |
| 35 | */ | 35 | */ |
| 36 | /* #define LUA_32BITS */ | 36 | /* #define LUA_32BITS */ |
| 37 | 37 | ||
| @@ -74,8 +74,8 @@ · 36 unmodified lines | |||
| 74 | 74 | ||
| 75 | /* | 75 | /* |
| 76 | @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for | 76 | @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for |
| 77 | ** C89 ('long' and 'double'); Windows has '__int64', so it does not need | 77 | ** C89 ('long' and 'double'); Windows always has '__int64', so it does |
| 78 | ** to use this case. | 78 | ** not need to use this case. |
| 79 | */ | 79 | */ |
| 80 | #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) | 80 | #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) |
| 81 | #define LUA_C89_NUMBERS | 81 | #define LUA_C89_NUMBERS |
| @@ -102,8 +102,8 @@ · 20 unmodified lines | |||
| 102 | ** the type for Lua floats. | 102 | ** the type for Lua floats. |
| 103 | ** Lua should work fine with any mix of these options (if supported | 103 | ** Lua should work fine with any mix of these options (if supported |
| 104 | ** by your C compiler). The usual configurations are 64-bit integers | 104 | ** by your C compiler). The usual configurations are 64-bit integers |
| 105 | ** and 'double' (the default), 32-bit integers and 'float' (Small Lua, | 105 | ** and 'double' (the default), 32-bit integers and 'float' (for |
| 106 | ** for restricted platforms), and 'long'/'double' (for C compilers not | 106 | ** restricted platforms), and 'long'/'double' (for C compilers not |
| 107 | ** compliant with C99, which may not have support for 'long long'). | 107 | ** compliant with C99, which may not have support for 'long long'). |
| 108 | */ | 108 | */ |
| 109 | 109 | ||
| @@ -127,8 +127,7 @@ · 17 unmodified lines | |||
| 127 | 127 | ||
| 128 | #else /* }{ */ | 128 | #else /* }{ */ |
| 129 | /* | 129 | /* |
| 130 | ** default configuration for 64-bit Lua ('long long' and 'double'); | 130 | ** default configuration for 64-bit Lua ('long long' and 'double') |
| 131 | ** Windows will use '__int64' | ||
| 132 | */ | 131 | */ |
| 133 | #define LUA_INT_LONGLONG | 132 | #define LUA_INT_LONGLONG |
| 134 | #define LUA_REAL_DOUBLE | 133 | #define LUA_REAL_DOUBLE |
| @@ -565,7 +564,17 @@ · 430 unmodified lines | |||
| 565 | 564 | ||
| 566 | #elif defined(LUA_INT_LONGLONG) /* }{ long long */ | 565 | #elif defined(LUA_INT_LONGLONG) /* }{ long long */ |
| 567 | 566 | ||
| 568 | #if defined(LUA_USE_WINDOWS) /* { */ | 567 | #if defined(LLONG_MAX) /* { */ |
| 568 | /* use ISO C99 stuff */ | ||
| 569 | |||
| 570 | #define LUA_INTEGER long long | ||
| 571 | #define LUA_INTEGER_FRMLEN "ll" | ||
| 572 | |||
| 573 | #define LUA_MAXINTEGER LLONG_MAX | ||
| 574 | #define LUA_MININTEGER LLONG_MIN | ||
| 575 | |||
| 576 | #elif defined(LUA_USE_WINDOWS) /* }{ */ | ||
| 577 | /* in Windows, can use specific Windows types */ | ||
| 569 | 578 | ||
| 570 | #define LUA_INTEGER __int64 | 579 | #define LUA_INTEGER __int64 |
| 571 | #define LUA_INTEGER_FRMLEN "I64" | 580 | #define LUA_INTEGER_FRMLEN "I64" |
| @@ -575,16 +584,8 @@ · 3 unmodified lines | |||
| 575 | 584 | ||
| 576 | #else /* }{ */ | 585 | #else /* }{ */ |
| 577 | 586 | ||
| 578 | #if !defined(LLONG_MAX) | ||
| 579 | #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ | 587 | #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ |
| 580 | or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" | 588 | or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" |
| 581 | #endif | ||
| 582 | |||
| 583 | #define LUA_INTEGER long long | ||
| 584 | #define LUA_INTEGER_FRMLEN "ll" | ||
| 585 | |||
| 586 | #define LUA_MAXINTEGER LLONG_MAX | ||
| 587 | #define LUA_MININTEGER LLONG_MIN | ||
| 588 | 589 | ||
| 589 | #endif /* } */ | 590 | #endif /* } */ |
| 590 | 591 | ||