From 16559ecd52698cfead11eca834903b686bf62d65 Mon Sep 17 00:00:00 2001 From: Lua Team Date: Tue, 21 Jun 2011 12:00:00 +0000 Subject: Lua 5.2.0-beta-rc2 --- doc/contents.html | 8 +- doc/lua.css | 3 +- doc/manual.html | 92 ++++++++++--------- doc/readme.html | 7 +- src/Makefile | 48 +++++----- src/lauxlib.c | 13 ++- src/lauxlib.h | 5 +- src/lbaselib.c | 21 +++-- src/lbitlib.c | 4 +- src/lctype.c | 45 --------- src/lctype.h | 50 ---------- src/ldo.c | 27 +++++- src/liolib.c | 267 ++++++++++++++++++++++++++---------------------------- src/llex.c | 102 +++++++++------------ src/llex.h | 4 +- src/lobject.c | 22 ++--- src/loslib.c | 4 +- src/lparser.c | 47 ++++++---- src/lparser.h | 5 +- src/lstrlib.c | 4 +- src/ltable.c | 4 +- src/lua.c | 4 +- src/luac.c | 6 +- src/lundump.c | 4 +- 24 files changed, 364 insertions(+), 432 deletions(-) delete mode 100644 src/lctype.c delete mode 100644 src/lctype.h diff --git a/doc/contents.html b/doc/contents.html index 5e94ebd1..13b33b08 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -40,7 +40,7 @@ For a complete introduction to Lua programming, see the book Copyright © 2011 Lua.org, PUC-Rio. Freely available under the terms of the -Lua license. +Lua license.

Contents

@@ -146,6 +146,8 @@ Freely available under the terms of the

_G
_VERSION
+ +

assert
collectgarbage
dofile
@@ -518,9 +520,9 @@ Freely available under the terms of the


- + Last update: -Mon Jun 13 15:09:33 BRT 2011 +Mon Jun 20 08:55:58 BRT 2011

- + @@ -54,7 +54,7 @@ functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight scripting language for any program that needs one. Lua is implemented as a library, written in clean C, -the common subset of ANSI C and C++. +the common subset of Standard C and C++.

@@ -192,8 +192,9 @@ There are several convenient ways to create tables in Lua

-We use the term sequence to denote a table where all -integer keys comprise the set {1..n} for some integer n, +We use the term sequence to denote a table where +the set of all positive numeric keys is equal to {1..n} +for some integer n, which is called the length of the sequence (see §3.4.6). @@ -234,7 +235,7 @@ of a given value.

2.2 – Environments and the Global Environment

-As discussed in §3.2 and §3.3.3, +As will be discussed in §3.2 and §3.3.3, any reference to a global name var is syntactically translated to _ENV.var. Moreover, every chunk is compiled in the scope of an external @@ -1136,7 +1137,7 @@ The following strings denote other tokens:

      +     -     *     /     %     ^     #
      ==    ~=    <=    >=    <     >     =
-     (     )     {     }     [     ]
+     (     )     {     }     [     ]     ::
      ;     :     ,     .     ..    ...
 
@@ -1239,7 +1240,7 @@ Lua also accepts hexadecimal constants, which start with 0x or 0X. Hexadecimal constants also accept an optional fractional part plus an optional binary exponent, -marked by a letter 'e' or 'E'. +marked by a letter 'p' or 'P'. Examples of valid numerical constants are
@@ -1531,12 +1532,13 @@ labels in Lua are considered statements too:
 
 	stat ::= goto Name
 	stat ::= label
-	label ::= ‘@’ Name ‘:’
+	label ::= ‘::’ Name ‘::

A label is visible in the entire block where it is defined (including nested blocks, but not nested functions). +A function cannot have more than one label with a given name. A goto may jump to any visible label as long as it does not enter into the scope of a local variable. @@ -1995,10 +1997,17 @@ character is one byte).

-The length of a table t is only defined if the +A program can modify the behavior of the length operator for +any value but strings through the __len metamethod (see §2.4). + + +

+Unless a __len metamethod is given, +the length of a table t is only defined if the table is a sequence, that is, -all its numeric keys comprise the set {1..n} for some integer n. +the set of its positive numeric keys is equal to {1..n} +for some integer n. In that case, n is its length. Note that a table like @@ -2008,16 +2017,11 @@ Note that a table like is not a sequence, because it has the key 4 but does not have the key 3. (So, there is no n such that the set {1..n} is equal -to the set of numeric keys of that table.) +to the set of positive numeric keys of that table.) Note, however, that non-numeric keys do not interfere with whether a table is a sequence. -

-A program can modify the behavior of the length operator for -any value but strings through the __len metamethod (see §2.4). - - @@ -2824,11 +2828,11 @@ It is used in the auxiliary library by luaL_newst return realloc(ptr, nsize); }

-Note that ANSI C ensures +Note that Standard C ensures that free(NULL) has no effect and that realloc(NULL, size) is equivalent to malloc(size). This code assumes that realloc does not fail when shrinking a block. -ANSI C does not ensure this behavior, +Standard C does not ensure this behavior, but it seems a safe assumption. @@ -2864,11 +2868,6 @@ The value of op must be one of the following constants: -

-When the operation is LUA_OPUNM, -the caller must push a nil value for the second operand. - - @@ -5907,7 +5906,7 @@ as return luaL_error(args).


luaL_execresult

-[-0, +(1/3), m] +[-0, +3, m]

int luaL_execresult (lua_State *L, int stat);

@@ -6097,7 +6096,7 @@ It is implemented as the following macro:


luaL_newlibtable

[-0, +1, m] -

int luaL_newlibtable (lua_State *L, const luaL_Reg *l);
+
int luaL_newlibtable (lua_State *L, const luaL_Reg l[]);

Creates a new table with a size optimized @@ -7471,7 +7470,7 @@ including if necessary a path and an extension.

-This function is not supported by ANSI C. +This function is not supported by Standard C. As such, it is only available on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix systems that support the dlfcn standard). @@ -8098,15 +8097,13 @@ It provides all its functions inside the table table -Currently, all functions in the table library assume that the table -represents a list. -In particular, they all ignore non-numeric keys -in tables given as arguments. -All functions in the table library, +Currently, all functions in the table library, except table.pack, -may apply the length operator on the list. -In that case, the list must be a proper sequence -or have a __len metamethod (see §3.4.6). +work on lists. +A list here means a proper sequence +or a table with a __len metamethod (see §3.4.6). +In particular, all functions ignore non-numeric keys +in lists given as arguments.

@@ -8135,7 +8132,8 @@ If i is greater than j, returns the empty string.

Inserts element value at position pos in list, -shifting up other elements to open space, if necessary. +shifting up the elements +list[pos], list[pos+1], ···, list[#list]. The default value for pos is #list+1, so that a call table.insert(t,x) inserts x at the end of list t. @@ -8162,7 +8160,9 @@ if any parameter is nil.

Removes from list the element at position pos, -shifting down other elements to close the space, if necessary. +shifting down the elements +list[pos+1], list[pos+2], ···, list[#list] +and erasing element list[#list]. Returns the value of the removed element. The default value for pos is #list, so that a call table.remove(t) removes the last element @@ -8177,12 +8177,12 @@ of list t.

Sorts list elements in a given order, in-place, -from table[1] to table[#list]. +from list[1] to list[#list]. If comp is given, then it must be a function that receives two list elements and returns true when the first element must come before the second in the final order -(so that not comp(a[i+1],a[i]) will be true after the sort). +(so that not comp(list[i+1],list[i]) will be true after the sort). If comp is not given, then the standard Lua operator < is used instead. @@ -8459,7 +8459,7 @@ Returns the angle x (given in degrees) in radians.

This function is an interface to the simple -pseudo-random generator function rand provided by ANSI C. +pseudo-random generator function rand provided by Standard C. (No guarantees can be given for its statistical properties.) @@ -9242,9 +9242,11 @@ this value is exactly t2-t1.

This function is equivalent to the C function system. It passes command to be executed by an operating system shell. -It returns true -if the command terminated successfully. -Otherwise, it returns nil plus a string and a number, +Its first result is true +if the command terminated successfully, +or nil otherwise. +After this first result +the function returns a string and a number, as follows:

    @@ -10139,7 +10141,7 @@ Here is the complete syntax of Lua in extended BNF. retstat ::= return [explist] [‘;’] - label ::= ‘@’ Name ‘:’ + label ::= ‘::’ Name ‘::’ funcname ::= Name {‘.’ Name} [‘:’ Name] @@ -10191,9 +10193,9 @@ Here is the complete syntax of Lua in extended BNF.
    - + Last update: -Mon Jun 13 14:56:14 BRT 2011 +Tue Jun 21 19:09:27 BRT 2011