diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/manual.html | 8 | ||||
-rw-r--r-- | src/lcode.c | 4 | ||||
-rw-r--r-- | src/lparser.c | 20 | ||||
-rw-r--r-- | src/lstrlib.c | 18 |
5 files changed, 25 insertions, 27 deletions
@@ -1,5 +1,5 @@ -This is Lua 5.3.3, released on 04 May 2016. +This is Lua 5.3.3, released on 18 May 2016. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/doc/manual.html b/doc/manual.html index 847b5188..6baf87f9 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -35,7 +35,7 @@ Freely available under the terms of the <!-- ====================================================================== --> <p> -<!-- $Id: manual.of,v 1.160 2016/05/03 15:51:04 roberto Exp $ --> +<!-- $Id: manual.of,v 1.161 2016/05/18 18:20:41 roberto Exp $ --> @@ -410,11 +410,11 @@ and the metamethod is the function that performs the addition. You can query the metatable of any value using the <a href="#pdf-getmetatable"><code>getmetatable</code></a> function. Lua queries metamethods in metatables using a raw access (see <a href="#pdf-rawget"><code>rawget</code></a>). -So, to retrieve the metamethod for event <code>env</code> in object <code>o</code>, +So, to retrieve the metamethod for event <code>ev</code> in object <code>o</code>, Lua does the equivalent to the following code: <pre> - rawget(getmetatable(<em>o</em>) or {}, "__<em>env</em>") + rawget(getmetatable(<em>o</em>) or {}, "__<em>ev</em>") </pre> <p> @@ -10898,7 +10898,7 @@ and LiteralString, see <a href="#3.1">§3.1</a>.) <P CLASS="footer"> Last update: -Wed May 4 20:35:23 BRT 2016 +Wed May 18 18:55:35 BRT 2016 </P> <!-- Last change: revised for Lua 5.3.3 diff --git a/src/lcode.c b/src/lcode.c index 1027aa1b..2cd0dd2d 100644 --- a/src/lcode.c +++ b/src/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.108 2016/01/05 16:22:37 roberto Exp $ +** $Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -1065,7 +1065,7 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { case OPR_MINUS: case OPR_BNOT: if (constfolding(fs, op + LUA_OPUNM, e, &ef)) break; - /* else go through */ + /* FALLTHROUGH */ case OPR_LEN: codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line); break; diff --git a/src/lparser.c b/src/lparser.c index 81fc7b1d..22530a57 100644 --- a/src/lparser.c +++ b/src/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.152 2016/03/07 19:25:39 roberto Exp $ +** $Id: lparser.c,v 2.153 2016/05/13 19:10:16 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -267,27 +267,26 @@ static void markupval (FuncState *fs, int level) { Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */ -static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { +static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { if (fs == NULL) /* no more levels? */ - return VVOID; /* default is global */ + init_exp(var, VVOID, 0); /* default is global */ else { int v = searchvar(fs, n); /* look up locals at current level */ if (v >= 0) { /* found? */ init_exp(var, VLOCAL, v); /* variable is local */ if (!base) markupval(fs, v); /* local will be used as an upval */ - return VLOCAL; } else { /* not found as local at current level; try upvalues */ int idx = searchupvalue(fs, n); /* try existing upvalues */ if (idx < 0) { /* not found? */ - if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */ - return VVOID; /* not found; is a global */ + singlevaraux(fs->prev, n, var, 0); /* try upper levels */ + if (var->k == VVOID) /* not found? */ + return; /* it is a global */ /* else was LOCAL or UPVAL */ idx = newupvalue(fs, n, var); /* will be a new upvalue */ } - init_exp(var, VUPVAL, idx); - return VUPVAL; + init_exp(var, VUPVAL, idx); /* new or old upvalue */ } } } @@ -296,10 +295,11 @@ static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { static void singlevar (LexState *ls, expdesc *var) { TString *varname = str_checkname(ls); FuncState *fs = ls->fs; - if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ + singlevaraux(fs, varname, var, 1); + if (var->k == VVOID) { /* global name? */ expdesc key; singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ - lua_assert(var->k == VLOCAL || var->k == VUPVAL); + lua_assert(var->k != VVOID); /* this one must exist */ codestring(ls, &key, varname); /* key is variable name */ luaK_indexed(fs, var, &key); /* env[varname] */ } diff --git a/src/lstrlib.c b/src/lstrlib.c index a610a0d7..99ce452a 100644 --- a/src/lstrlib.c +++ b/src/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.248 2016/05/02 13:58:01 roberto Exp $ +** $Id: lstrlib.c,v 1.250 2016/05/18 18:19:51 roberto Exp $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -958,8 +958,8 @@ static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { addliteralnum(L, b, lua_tonumber(L, arg)); break; } - /* else integers; write in "native" format *//* FALLTHROUGH */ - } + /* else integers; write in "native" format */ + } /* FALLTHROUGH */ case LUA_TNIL: case LUA_TBOOLEAN: { luaL_tolstring(L, arg, NULL); luaL_addvalue(b); @@ -1369,13 +1369,11 @@ static int str_pack (lua_State *L) { case Kchar: { /* fixed-size string */ size_t len; const char *s = luaL_checklstring(L, arg, &len); - if ((size_t)size <= len) /* string larger than (or equal to) needed? */ - luaL_addlstring(&b, s, size); /* truncate string to asked size */ - else { /* string smaller than needed */ - luaL_addlstring(&b, s, len); /* add it all */ - while (len++ < (size_t)size) /* pad extra space */ - luaL_addchar(&b, LUAL_PACKPADBYTE); - } + luaL_argcheck(L, len <= (size_t)size, arg, + "string longer than given size"); + luaL_addlstring(&b, s, len); /* add string */ + while (len++ < (size_t)size) /* pad extra space */ + luaL_addchar(&b, LUAL_PACKPADBYTE); break; } case Kstring: { /* strings with length count */ |