Unified · Split
| @@ -1,34 +1,33 @@ | ||
| 1 | −MANIFEST contents of Lua 5.1 distribution on Tue Feb 7 15:05:04 BRST 2006 | |
| 1 | +MANIFEST contents of Lua 5.1 distribution on Fri Feb 10 17:19:52 BRST 2006 | |
| 2 | 2 | lua-5.1 |
| 3 | 3 | lua-5.1/COPYRIGHT |
| 4 | −lua-5.1/HISTORY | |
| 5 | −lua-5.1/INSTALL | |
| 6 | −lua-5.1/MANIFEST | |
| 7 | −lua-5.1/Makefile | |
| 8 | −lua-5.1/README | |
| 9 | 4 | lua-5.1/doc |
| 10 | 5 | lua-5.1/doc/contents.html |
| 11 | 6 | lua-5.1/doc/logo.gif |
| 12 | 7 | lua-5.1/doc/lua.1 |
| 13 | −lua-5.1/doc/lua.css | |
| 14 | −lua-5.1/doc/lua.html | |
| 15 | 8 | lua-5.1/doc/luac.1 |
| 16 | 9 | lua-5.1/doc/luac.html |
| 10 | +lua-5.1/doc/lua.css | |
| 11 | +lua-5.1/doc/lua.html | |
| 17 | 12 | lua-5.1/doc/manual.html |
| 18 | 13 | lua-5.1/doc/readme.html |
| 19 | 14 | lua-5.1/etc |
| 20 | −lua-5.1/etc/Makefile | |
| 21 | −lua-5.1/etc/README | |
| 22 | 15 | lua-5.1/etc/all.c |
| 23 | 16 | lua-5.1/etc/lua.hpp |
| 24 | 17 | lua-5.1/etc/lua.ico |
| 25 | 18 | lua-5.1/etc/lua.pc |
| 26 | 19 | lua-5.1/etc/luavs.bat |
| 20 | +lua-5.1/etc/Makefile | |
| 27 | 21 | lua-5.1/etc/min.c |
| 28 | 22 | lua-5.1/etc/noparser.c |
| 23 | +lua-5.1/etc/README | |
| 29 | 24 | lua-5.1/etc/strict.lua |
| 25 | +lua-5.1/HISTORY | |
| 26 | +lua-5.1/INSTALL | |
| 27 | +lua-5.1/Makefile | |
| 28 | +lua-5.1/MANIFEST | |
| 29 | +lua-5.1/README | |
| 30 | 30 | lua-5.1/src |
| 31 | −lua-5.1/src/Makefile | |
| 32 | 31 | lua-5.1/src/lapi.c |
| 33 | 32 | lua-5.1/src/lapi.h |
| 34 | 33 | lua-5.1/src/lauxlib.c |
| @@ -73,9 +72,9 @@ lua-5.1/src/ltablib.c · 38 unmodified lines | ||
| 73 | 72 | lua-5.1/src/ltm.c |
| 74 | 73 | lua-5.1/src/ltm.h |
| 75 | 74 | lua-5.1/src/lua.c |
| 76 | −lua-5.1/src/lua.h | |
| 77 | 75 | lua-5.1/src/luac.c |
| 78 | 76 | lua-5.1/src/luaconf.h |
| 77 | +lua-5.1/src/lua.h | |
| 79 | 78 | lua-5.1/src/lualib.h |
| 80 | 79 | lua-5.1/src/lundump.c |
| 81 | 80 | lua-5.1/src/lundump.h |
| @@ -83,21 +82,22 @@ lua-5.1/src/lvm.c · 1 unmodified line | ||
| 83 | 82 | lua-5.1/src/lvm.h |
| 84 | 83 | lua-5.1/src/lzio.c |
| 85 | 84 | lua-5.1/src/lzio.h |
| 85 | +lua-5.1/src/Makefile | |
| 86 | 86 | lua-5.1/src/print.c |
| 87 | 87 | lua-5.1/test |
| 88 | −lua-5.1/test/README | |
| 89 | 88 | lua-5.1/test/bisect.lua |
| 90 | 89 | lua-5.1/test/cf.lua |
| 91 | 90 | lua-5.1/test/echo.lua |
| 92 | 91 | lua-5.1/test/env.lua |
| 93 | 92 | lua-5.1/test/factorial.lua |
| 94 | −lua-5.1/test/fib.lua | |
| 95 | 93 | lua-5.1/test/fibfor.lua |
| 94 | +lua-5.1/test/fib.lua | |
| 96 | 95 | lua-5.1/test/globals.lua |
| 97 | 96 | lua-5.1/test/hello.lua |
| 98 | 97 | lua-5.1/test/life.lua |
| 99 | 98 | lua-5.1/test/luac.lua |
| 100 | 99 | lua-5.1/test/printf.lua |
| 100 | +lua-5.1/test/README | |
| 101 | 101 | lua-5.1/test/readonly.lua |
| 102 | 102 | lua-5.1/test/sieve.lua |
| 103 | 103 | lua-5.1/test/sort.lua |
| @@ -93,7 +93,9 @@ Lua 5.1 Reference Manual · 92 unmodified lines | ||
| 93 | 93 | <LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A> |
| 94 | 94 | </UL> |
| 95 | 95 | <LI><A HREF="manual.html#6">6 - Lua Stand-alone</A> |
| 96 | +<LI><A HREF="manual.html#incompat">Incompatibilities with the Previous Version</A> | |
| 96 | 97 | <LI><A HREF="manual.html#BNF">The Complete Syntax of Lua</A> |
| 98 | + | |
| 97 | 99 | </UL> |
| 98 | 100 | |
| 99 | 101 | <H2><A NAME="quick">Quick index</A></H2> |
| @@ -396,7 +398,7 @@ Lua 5.1 Reference Manual · 296 unmodified lines | ||
| 396 | 398 | <HR> |
| 397 | 399 | <SMALL> |
| 398 | 400 | Last update: |
| 399 | −Tue Feb 7 14:37:59 BRST 2006 | |
| 401 | +Fri Feb 10 17:15:37 BRST 2006 | |
| 400 | 402 | </SMALL> |
| 401 | 403 | |
| 402 | 404 | </BODY> |
| @@ -6059,7 +6059,7 @@ is a more portable solution.) · 6058 unmodified lines | ||
| 6059 | 6059 | |
| 6060 | 6060 | <p><hr></hr> |
| 6061 | 6061 | |
| 6062 | −<p><h1>Incompatibilities with the Previous Version</h1> | |
| 6062 | +<p><a name="incompat"></a><h1>Incompatibilities with the Previous Version</h1> | |
| 6063 | 6063 | |
| 6064 | 6064 | |
| 6065 | 6065 | <p>Here we list the incompatibilities that may be found when moving a program |
| @@ -6118,6 +6118,10 @@ Function <code>loadlib</code> was renamed <a href="#pdf-package.loadlib"><code>p · 52 unmodified lines | ||
| 6118 | 6118 | Function <code>math.mod</code> was renamed <a href="#pdf-math.fmod"><code>math.fmod</code></a>. |
| 6119 | 6119 | (Option <code>LUA_COMPAT_MOD</code>) |
| 6120 | 6120 | |
| 6121 | +<p><li> | |
| 6122 | +Functions <code>table.foreach</code> and <code>table.foreachi</code> are deprecated. | |
| 6123 | +You can use a for loop with <code>pairs</code> or <code>ipairs</code> instead. | |
| 6124 | + | |
| 6121 | 6125 | <p><li> |
| 6122 | 6126 | There were substantial changes in function <a href="#pdf-require"><code>require</code></a> due to |
| 6123 | 6127 | the new module system. |
| @@ -16,7 +16,7 @@ MYLIBS= -lm · 15 unmodified lines | ||
| 16 | 16 | RM= rm -f |
| 17 | 17 | |
| 18 | 18 | default: |
| 19 | − @echo 'Please choose a target: min noparser one clean' | |
| 19 | + @echo 'Please choose a target: min noparser one strict clean' | |
| 20 | 20 | |
| 21 | 21 | min: min.c |
| 22 | 22 | $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include <stdio.h> |
| 8 | + | |
| 8 | 9 | #include "lua.h" |
| 9 | 10 | #include "lauxlib.h" |
| 10 | 11 | |
| @@ -17,32 +18,22 @@ static int print(lua_State *L) · 6 unmodified lines | ||
| 17 | 18 | if (i>1) printf("\t"); |
| 18 | 19 | if (lua_isstring(L,i)) |
| 19 | 20 | printf("%s",lua_tostring(L,i)); |
| 20 | − else if (lua_isnil(L,i)) | |
| 21 | + else if (lua_isnil(L,i)==2) | |
| 21 | 22 | printf("%s","nil"); |
| 22 | 23 | else if (lua_isboolean(L,i)) |
| 23 | 24 | printf("%s",lua_toboolean(L,i) ? "true" : "false"); |
| 24 | 25 | else |
| 25 | − printf("%s:%p",lua_typename(L,lua_type(L,i)),lua_topointer(L,i)); | |
| 26 | + printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i)); | |
| 26 | 27 | } |
| 27 | 28 | printf("\n"); |
| 28 | 29 | return 0; |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | −static const char *getF(lua_State *L, void *ud, size_t *size) | |
| 32 | −{ | |
| 33 | − FILE *f=(FILE *)ud; | |
| 34 | − static char buff[512]; | |
| 35 | − if (feof(f)) return NULL; | |
| 36 | − *size=fread(buff,1,sizeof(buff),f); | |
| 37 | − return (*size>0) ? buff : NULL; | |
| 38 | −} | |
| 39 | − | |
| 40 | 32 | int main(void) |
| 41 | 33 | { |
| 42 | 34 | lua_State *L=lua_open(); |
| 43 | 35 | lua_register(L,"print",print); |
| 44 | − if (lua_load(L,getF,stdin,"=stdin") || lua_pcall(L,0,0,0)) | |
| 45 | − fprintf(stderr,"%s\n",lua_tostring(L,-1)); | |
| 36 | + if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1)); | |
| 46 | 37 | lua_close(L); |
| 47 | 38 | return 0; |
| 48 | 39 | } |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lobject.c,v 2.21 2006/01/10 12:50:00 roberto Exp $ | |
| 2 | +** $Id: lobject.c,v 2.22 2006/02/10 17:43:52 roberto Exp $ | |
| 3 | 3 | ** Some generic functions over Lua objects |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -91,6 +91,8 @@ int luaO_str2d (const char *s, lua_Number *result) { · 85 unmodified lines | ||
| 91 | 91 | char *endptr; |
| 92 | 92 | *result = lua_str2number(s, &endptr); |
| 93 | 93 | if (endptr == s) return 0; /* conversion failed */ |
| 94 | + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ | |
| 95 | + *result = cast_num(strtoul(s, &endptr, 16)); | |
| 94 | 96 | if (*endptr == '\0') return 1; /* most common case */ |
| 95 | 97 | while (isspace(cast(unsigned char, *endptr))) endptr++; |
| 96 | 98 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: luaconf.h,v 1.80 2006/01/27 13:54:39 roberto Exp $ | |
| 2 | +** $Id: luaconf.h,v 1.81 2006/02/10 17:44:06 roberto Exp $ | |
| 3 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -650,9 +650,9 @@ union luai_Cast { double l_d; long l_l; }; · 644 unmodified lines | ||
| 650 | 650 | |
| 651 | 651 | #else |
| 652 | 652 | |
| 653 | −#define lua_popen(L,c,m) \ | |
| 654 | − ((void)c, (void)m, luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | |
| 655 | −#define lua_pclose(L,file) ((void)L, (void)file, 0) | |
| 653 | +#define lua_popen(L,c,m) ((void)((void)c, m), \ | |
| 654 | + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | |
| 655 | +#define lua_pclose(L,file) ((void)((void)L, file), 0) | |
| 656 | 656 | |
| 657 | 657 | #endif |
| 658 | 658 | |