Unified · Split
| @@ -9,7 +9,7 @@ For details and rationale, see http://www.lua.org/license.html . · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | =============================================================================== |
| 11 | 11 | |
| 12 | −Copyright (C) 1994-2007 Lua.org, PUC-Rio. | |
| 12 | +Copyright (C) 1994-2008 Lua.org, PUC-Rio. | |
| 13 | 13 | |
| 14 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 15 | 15 | of this software and associated documentation files (the "Software"), to deal |
| @@ -1,7 +1,9 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 1 | 2 | <HTML> |
| 2 | 3 | <HEAD> |
| 3 | 4 | <TITLE>Lua 5.1 Reference Manual - contents</TITLE> |
| 4 | 5 | <LINK REL="stylesheet" TYPE="text/css" HREF="lua.css"> |
| 6 | +<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1"> | |
| 5 | 7 | <STYLE TYPE="text/css"> |
| 6 | 8 | ul { |
| 7 | 9 | list-style-type: none ; |
| @@ -49,9 +51,9 @@ For a complete introduction to Lua programming, see the book · 41 unmodified lines | ||
| 49 | 51 | · |
| 50 | 52 | <A HREF="#index">index</A> |
| 51 | 53 | · |
| 52 | −<A HREF="http://www.lua.org/manual/5.1/pt/">português</A> | |
| 54 | +<A HREF="http://www.lua.org/manual/5.1/pt/">portugu�s</A> | |
| 53 | 55 | · |
| 54 | −<A HREF="http://www.lua.org/manual/5.1/es/">español</A> | |
| 56 | +<A HREF="http://www.lua.org/manual/5.1/es/">espa�ol</A> | |
| 55 | 57 | <HR> |
| 56 | 58 | <SMALL> |
| 57 | 59 | Copyright © 2006-2008 Lua.org, PUC-Rio. |
| @@ -486,7 +488,7 @@ Freely available under the terms of the · 428 unmodified lines | ||
| 486 | 488 | <HR> |
| 487 | 489 | <SMALL> |
| 488 | 490 | Last update: |
| 489 | −Thu Jan 17 14:50:23 BRST 2008 | |
| 491 | +Fri Jan 18 10:36:25 BRST 2008 | |
| 490 | 492 | </SMALL> |
| 491 | 493 | <!-- |
| 492 | 494 | Last change: revised for Lua 5.1.3 |
| @@ -1,10 +1,11 @@ | ||
| 1 | −<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> | |
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | 2 | <html> |
| 3 | 3 | |
| 4 | 4 | <head> |
| 5 | 5 | <title>Lua 5.1 Reference Manual</title> |
| 6 | 6 | <link rel="stylesheet" href="lua.css"> |
| 7 | 7 | <link rel="stylesheet" href="manual.css"> |
| 8 | +<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1"> | |
| 8 | 9 | </head> |
| 9 | 10 | |
| 10 | 11 | <body> |
| @@ -32,7 +33,7 @@ Freely available under the terms of the · 21 unmodified lines | ||
| 32 | 33 | <!-- ====================================================================== --> |
| 33 | 34 | <p> |
| 34 | 35 | |
| 35 | −<!-- $Id: manual.of,v 1.43 2008/01/17 16:19:44 roberto Exp $ --> | |
| 36 | +<!-- $Id: manual.of,v 1.44 2008/01/18 16:41:50 roberto Exp $ --> | |
| 36 | 37 | |
| 37 | 38 | |
| 38 | 39 | |
| @@ -179,6 +180,7 @@ which can be specified as '<code>\0</code>'. · 140 unmodified lines | ||
| 179 | 180 | |
| 180 | 181 | <p> |
| 181 | 182 | To put a double (single) quote, a newline, a backslash, |
| 183 | +a carriage return, | |
| 182 | 184 | or an embedded zero |
| 183 | 185 | inside a literal string enclosed by double (single) quotes |
| 184 | 186 | you must use an escape sequence. |
| @@ -2665,7 +2667,7 @@ of numerical arguments and returns their average and sum: · 2480 unmodified lines | ||
| 2665 | 2667 | |
| 2666 | 2668 | |
| 2667 | 2669 | <hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3><p> |
| 2668 | −<span class="apii">[-0, +0, <em>-</em>]</span> | |
| 2670 | +<span class="apii">[-0, +0, <em>m</em>]</span> | |
| 2669 | 2671 | <pre>int lua_checkstack (lua_State *L, int extra);</pre> |
| 2670 | 2672 | |
| 2671 | 2673 | <p> |
| @@ -3767,7 +3769,7 @@ The reader function may return pieces of any size greater than zero. · 1095 unmodified lines | ||
| 3767 | 3769 | |
| 3768 | 3770 | |
| 3769 | 3771 | <hr><h3><a name="lua_register"><code>lua_register</code></a></h3><p> |
| 3770 | −<span class="apii">[-0, +0, <em>m</em>]</span> | |
| 3772 | +<span class="apii">[-0, +0, <em>e</em>]</span> | |
| 3771 | 3773 | <pre>void lua_register (lua_State *L, |
| 3772 | 3774 | const char *name, |
| 3773 | 3775 | lua_CFunction f);</pre> |
| @@ -4395,7 +4397,7 @@ Returns the current hook mask. · 621 unmodified lines | ||
| 4395 | 4397 | |
| 4396 | 4398 | |
| 4397 | 4399 | <hr><h3><a name="lua_getinfo"><code>lua_getinfo</code></a></h3><p> |
| 4398 | −<span class="apii">[-(0|1), +(0|1|2), <em>-</em>]</span> | |
| 4400 | +<span class="apii">[-(0|1), +(0|1|2), <em>m</em>]</span> | |
| 4399 | 4401 | <pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre> |
| 4400 | 4402 | |
| 4401 | 4403 | <p> |
| @@ -8739,7 +8741,7 @@ Here is the complete syntax of Lua in extended BNF. · 4337 unmodified lines | ||
| 8739 | 8741 | <HR> |
| 8740 | 8742 | <SMALL> |
| 8741 | 8743 | Last update: |
| 8742 | −Thu Jan 17 15:06:18 BRST 2008 | |
| 8744 | +Fri Jan 18 14:50:20 BRST 2008 | |
| 8743 | 8745 | </SMALL> |
| 8744 | 8746 | <!-- |
| 8745 | 8747 | Last change: revised for Lua 5.1.3 |
| @@ -18,7 +18,7 @@ static int print(lua_State *L) · 17 unmodified lines | ||
| 18 | 18 | if (i>1) printf("\t"); |
| 19 | 19 | if (lua_isstring(L,i)) |
| 20 | 20 | printf("%s",lua_tostring(L,i)); |
| 21 | − else if (lua_isnil(L,i)==2) | |
| 21 | + else if (lua_isnil(L,i)) | |
| 22 | 22 | printf("%s","nil"); |
| 23 | 23 | else if (lua_isboolean(L,i)) |
| 24 | 24 | printf("%s",lua_toboolean(L,i) ? "true" : "false"); |
| @@ -6,6 +6,8 @@ · 5 unmodified lines | ||
| 6 | 6 | -- anywhere or assigned to inside a function. |
| 7 | 7 | -- |
| 8 | 8 | |
| 9 | +local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget | |
| 10 | + | |
| 9 | 11 | local mt = getmetatable(_G) |
| 10 | 12 | if mt == nil then |
| 11 | 13 | mt = {} |
| @@ -15,7 +17,7 @@ end · 3 unmodified lines | ||
| 15 | 17 | mt.__declared = {} |
| 16 | 18 | |
| 17 | 19 | local function what () |
| 18 | − local d = debug.getinfo(3, "S") | |
| 20 | + local d = getinfo(3, "S") | |
| 19 | 21 | return d and d.what or "C" |
| 20 | 22 | end |
| 21 | 23 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: ldblib.c,v 1.104.1.1 2007/12/27 13:02:25 roberto Exp $ | |
| 2 | +** $Id: ldblib.c,v 1.104.1.2 2008/01/18 16:39:45 roberto Exp $ | |
| 3 | 3 | ** Interface from Lua to its debug API |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -255,17 +255,18 @@ static void gethooktable (lua_State *L) { · 249 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | static int db_sethook (lua_State *L) { |
| 258 | − int arg; | |
| 258 | + int arg, mask, count; | |
| 259 | + lua_Hook func; | |
| 259 | 260 | lua_State *L1 = getthread(L, &arg); |
| 260 | 261 | if (lua_isnoneornil(L, arg+1)) { |
| 261 | 262 | lua_settop(L, arg+1); |
| 262 | − lua_sethook(L1, NULL, 0, 0); /* turn off hooks */ | |
| 263 | + func = NULL; mask = 0; count = 0; /* turn off hooks */ | |
| 263 | 264 | } |
| 264 | 265 | else { |
| 265 | 266 | const char *smask = luaL_checkstring(L, arg+2); |
| 266 | − int count = luaL_optint(L, arg+3, 0); | |
| 267 | 267 | luaL_checktype(L, arg+1, LUA_TFUNCTION); |
| 268 | − lua_sethook(L1, hookf, makemask(smask, count), count); | |
| 268 | + count = luaL_optint(L, arg+3, 0); | |
| 269 | + func = hookf; mask = makemask(smask, count); | |
| 269 | 270 | } |
| 270 | 271 | gethooktable(L1); |
| 271 | 272 | lua_pushlightuserdata(L1, L1); |
| @@ -273,6 +274,7 @@ static int db_sethook (lua_State *L) { · 1 unmodified line | ||
| 273 | 274 | lua_xmove(L, L1, 1); |
| 274 | 275 | lua_rawset(L1, -3); /* set new hook */ |
| 275 | 276 | lua_pop(L1, 1); /* remove hook table */ |
| 277 | + lua_sethook(L1, func, mask, count); /* set hooks */ | |
| 276 | 278 | return 0; |
| 277 | 279 | } |
| 278 | 280 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: loslib.c,v 1.19.1.2 2007/12/28 14:58:43 roberto Exp $ | |
| 2 | +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ | |
| 3 | 3 | ** Standard Operating System library |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -215,7 +215,6 @@ static int os_setlocale (lua_State *L) { · 209 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | static int os_exit (lua_State *L) { |
| 217 | 217 | exit(luaL_optint(L, 1, EXIT_SUCCESS)); |
| 218 | − return 0; /* to avoid warnings */ | |
| 219 | 218 | } |
| 220 | 219 | |
| 221 | 220 | static const luaL_Reg syslib[] = { |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: luaconf.h,v 1.82.1.5 2008/01/17 14:04:20 roberto Exp $ | |
| 2 | +** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $ | |
| 3 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -667,7 +667,7 @@ union luai_Cast { double l_d; long l_l; }; · 661 unmodified lines | ||
| 667 | 667 | */ |
| 668 | 668 | #if defined(LUA_USE_POPEN) |
| 669 | 669 | |
| 670 | −#define lua_popen(L,c,m) ((void)L, popen(c,m)) | |
| 670 | +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) | |
| 671 | 671 | #define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) |
| 672 | 672 | |
| 673 | 673 | #elif defined(LUA_WIN) |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lundump.c,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ | |
| 2 | +** $Id: lundump.c,v 2.7.1.2 2008/01/18 16:39:11 roberto Exp $ | |
| 3 | 3 | ** load precompiled Lua chunks |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -29,6 +29,7 @@ typedef struct { · 23 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #ifdef LUAC_TRUST_BINARIES |
| 31 | 31 | #define IF(c,s) |
| 32 | +#define error(S,s) | |
| 32 | 33 | #else |
| 33 | 34 | #define IF(c,s) if (c) error(S,s) |
| 34 | 35 | |
| @@ -47,6 +48,7 @@ static void error(LoadState* S, const char* why) · 12 unmodified lines | ||
| 47 | 48 | static void LoadBlock(LoadState* S, void* b, size_t size) |
| 48 | 49 | { |
| 49 | 50 | size_t r=luaZ_read(S->Z,b,size); |
| 51 | + UNUSED(r); | |
| 50 | 52 | IF (r!=0, "unexpected end"); |
| 51 | 53 | } |
| 52 | 54 | |
| @@ -122,7 +124,7 @@ static void LoadConstants(LoadState* S, Proto* f) · 69 unmodified lines | ||
| 122 | 124 | setsvalue2n(S->L,o,LoadString(S)); |
| 123 | 125 | break; |
| 124 | 126 | default: |
| 125 | − IF (1, "bad constant"); | |
| 127 | + error(S,"bad constant"); | |
| 126 | 128 | break; |
| 127 | 129 | } |
| 128 | 130 | } |