diff --git a/Makefile b/Makefile index e87e958c..119110d2 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.3 -R= $V.2 +R= $V.4 # Targets start here. all: $(PLAT) diff --git a/README.md b/README.md index eb6247a4..ed424def 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -This is Lua 5.3.2, released on 25 Nov 2015. +This is Lua 5.3.5, released on 26 Jun 2018. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/dist.info b/dist.info index b9987268..a851b17e 100644 --- a/dist.info +++ b/dist.info @@ -1,7 +1,7 @@ --- This file is part of LuaDist project name = "lua" -version = "5.3.2" +version = "5.3.5" desc = "Lua is a powerful, fast, light-weight, embeddable scripting language." author = "Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo" diff --git a/doc/contents.html b/doc/contents.html index 1272c59c..c4eb2677 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -32,7 +32,7 @@

-Copyright © 2015 Lua.org, PUC-Rio. +Copyright © 2015–2018 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -512,6 +512,7 @@

auxiliary library

luaL_newmetatable
luaL_newstate
luaL_openlibs
+luaL_opt
luaL_optinteger
luaL_optlstring
luaL_optnumber
@@ -608,10 +609,10 @@

constants

diff --git a/doc/logo.gif b/doc/logo.gif index 2f5e4ac2..5c77eacc 100644 Binary files a/doc/logo.gif and b/doc/logo.gif differ diff --git a/doc/lua.1 b/doc/lua.1 index 411531b9..d728d0b8 100644 --- a/doc/lua.1 +++ b/doc/lua.1 @@ -1,4 +1,5 @@ -.TH LUA 1 "$Date: 2014/12/10 15:55:45 $" +.\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $ +.TH LUA 1 "$Date: 2016/10/17 15:43:50 $" .SH NAME lua \- Lua interpreter .SH SYNOPSIS diff --git a/doc/lua.css b/doc/lua.css index eb20fecd..cbd0799d 100644 --- a/doc/lua.css +++ b/doc/lua.css @@ -10,7 +10,7 @@ body { line-height: 1.25 ; margin: 16px auto ; padding: 32px ; - border: solid #a0a0a0 1px ; + border: solid #ccc 1px ; border-radius: 20px ; max-width: 70em ; width: 90% ; @@ -92,6 +92,7 @@ table hr { .footer { color: gray ; font-size: x-small ; + text-transform: lowercase ; } input[type=text] { @@ -110,36 +111,29 @@ pre.session { border-radius: 8px ; } -td.gutter { - width: 4% ; -} - -table.columns { +table { border: none ; border-spacing: 0 ; border-collapse: collapse ; } -table.columns td { - vertical-align: top ; +td { padding: 0 ; - padding-bottom: 1em ; - text-align: justify ; - line-height: 1.25 ; + margin: 0 ; } -p.logos a:link:hover, p.logos a:visited:hover { - background-color: inherit ; +td.gutter { + width: 4% ; } -table.book { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; +table.columns td { + vertical-align: top ; + padding-bottom: 1em ; + text-align: justify ; + line-height: 1.25 ; } table.book td { - padding: 0 ; vertical-align: top ; } @@ -157,3 +151,11 @@ table.book span { display: block ; margin-top: 0.25em ; } + +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; +} + +img { + background-color: white ; +} diff --git a/doc/manual.html b/doc/manual.html index 60c4c98b..89a642a4 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@

-Copyright © 2015 Lua.org, PUC-Rio. +Copyright © 2015–2018 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -35,7 +35,7 @@

- + @@ -43,30 +43,47 @@

1 – Introduction

-Lua is an extension programming language designed to support -general procedural programming with data description -facilities. -Lua also offers good support for object-oriented programming, -functional programming, and data-driven programming. -Lua is intended to be used as a powerful, lightweight, -embeddable scripting language for any program that needs one. +Lua is a powerful, efficient, lightweight, embeddable scripting language. +It supports procedural programming, +object-oriented programming, functional programming, +data-driven programming, and data description. + + +

+Lua combines simple procedural syntax with powerful data description +constructs based on associative arrays and extensible semantics. +Lua is dynamically typed, +runs by interpreting bytecode with a register-based +virtual machine, +and has automatic memory management with +incremental garbage collection, +making it ideal for configuration, scripting, +and rapid prototyping. + + +

Lua is implemented as a library, written in clean C, the common subset of Standard C and C++. +The Lua distribution includes a host program called lua, +which uses the Lua library to offer a complete, +standalone Lua interpreter, +for interactive or batch use. +Lua is intended to be used both as a powerful, lightweight, +embeddable scripting language for any program that needs one, +and as a powerful but lightweight and efficient stand-alone language.

As an extension language, Lua has no notion of a "main" program: -it only works embedded in a host client, +it works embedded in a host client, called the embedding program or simply the host. +(Frequently, this host is the stand-alone lua program.) The host program can invoke functions to execute a piece of Lua code, can write and read Lua variables, and can register C functions to be called by Lua code. Through the use of C functions, Lua can be augmented to cope with a wide range of different domains, thus creating customized programming languages sharing a syntactical framework. -The Lua distribution includes a sample host program called lua, -which uses the Lua library to offer a complete, standalone Lua interpreter, -for interactive or batch use.

@@ -186,8 +203,8 @@

2.1 – Values and Types

The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any Lua value except nil and NaN. +that is, arrays that can have as indices not only numbers, +but any Lua value except nil and NaN. (Not a Number is a special value used to represent undefined or unrepresentable numerical results, such as 0/0.) Tables can be heterogeneous; @@ -199,7 +216,7 @@

2.1 – Values and Types

Tables are the sole data-structuring mechanism in Lua; -they can be used to represent ordinary arrays, sequences, +they can be used to represent ordinary arrays, lists, symbol tables, sets, records, graphs, trees, etc. To represent records, Lua uses the field name as an index. The language supports this representation by @@ -208,13 +225,6 @@

2.1 – Values and Types

(see §3.4.9). -

-We use the term sequence to denote a table where -the set of all positive numeric keys is equal to {1..n} -for some non-negative integer n, -which is called the length of the sequence (see §3.4.7). - -

Like indices, the values of table fields can be of any type. @@ -351,8 +361,8 @@

2.3 – Error Handling

When you use xpcall or lua_pcall, you may give a message handler to be called in case of errors. -This function is called with the original error message -and returns a new error message. +This function is called with the original error object +and returns a new error object. It is called before the error unwinds the stack, so that it can gather more information about the error, for instance by inspecting the stack and creating a stack traceback. @@ -361,6 +371,9 @@

2.3 – Error Handling

will call the message handler again. If this loop goes on for too long, Lua breaks it and returns an appropriate message. +(The message handler is called only for regular runtime errors. +It is not called for memory-allocation errors +nor for errors while running finalizers.) @@ -382,16 +395,25 @@

2.4 – Metatables and Metamethods

-The keys in a metatable are derived from the event names; +The key for each event in a metatable is a string +with the event name prefixed by two underscores; the corresponding values are called metamethods. -In the previous example, the event is "add" +In the previous example, the key is "__add" and the metamethod is the function that performs the addition. +Unless stated otherwise, +metamethods should be function values.

You can query the metatable of any value using the getmetatable function. +Lua queries metamethods in metatables using a raw access (see rawget). +So, to retrieve the metamethod for event ev in object o, +Lua does the equivalent to the following code: +

+     rawget(getmetatable(o) or {}, "__ev")
+

You can replace the metatable of tables @@ -420,18 +442,7 @@

2.4 – Metatables and Metamethods

-A detailed list of events controlled by metatables is given next. -Each operation is identified by its corresponding event name. -The key for each event is a string with its name prefixed by -two underscores, '__'; -for instance, the key for operation "add" is the -string "__add". -Note that queries for metamethods are always raw; -the access to a metamethod does not invoke other metamethods. - - -

-For the unary operators (negation, length, and bitwise not), +For the unary operators (negation, length, and bitwise NOT), the metamethod is computed and called with a dummy second operand, equal to the first one. This extra operand is only to simplify Lua's internals @@ -440,17 +451,21 @@

2.4 – Metatables and Metamethods

(For most uses this extra operand is irrelevant.) +

+A detailed list of events controlled by metatables is given next. +Each operation is identified by its corresponding key. + -

@@ -4255,7 +4342,7 @@

4.8 – Functions and Types

When n is zero, -this function creates a light C function, +this function creates a light C function, which is just a pointer to the C function. In that case, it never raises a memory error. @@ -4269,7 +4356,7 @@

4.8 – Functions and Types

Pushes a C function onto the stack. -This function receives a pointer to a C function +This function receives a pointer to a C function and pushes onto the stack a Lua value of type function that, when called, invokes the corresponding C function. @@ -4284,7 +4371,7 @@

4.8 – Functions and Types


lua_pushfstring

-[-0, +1, m] +[-0, +1, e]

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);

@@ -4317,6 +4404,12 @@

4.8 – Functions and Types

+

+Unlike other push functions, +this function checks for the stack space it needs, +including the slot for its result. + + @@ -4486,7 +4579,7 @@

4.8 – Functions and Types

Returns 1 if the two values in indices index1 and index2 are primitively equal -(that is, without calling metamethods). +(that is, without calling the __eq metamethod). Otherwise returns 0. Also returns 0 if any of the indices are not valid. @@ -4513,8 +4606,8 @@

4.8 – Functions and Types

Pushes onto the stack the value t[n], where t is the table at the given index. -The access is raw; -that is, it does not invoke metamethods. +The access is raw, +that is, it does not invoke the __index metamethod.

@@ -4533,7 +4626,7 @@

4.8 – Functions and Types

where t is the table at the given index and k is the pointer p represented as a light userdata. The access is raw; -that is, it does not invoke metamethods. +that is, it does not invoke the __index metamethod.

@@ -4584,8 +4677,8 @@

4.8 – Functions and Types

This function pops the value from the stack. -The assignment is raw; -that is, it does not invoke metamethods. +The assignment is raw, +that is, it does not invoke the __newindex metamethod. @@ -4604,8 +4697,8 @@

4.8 – Functions and Types

This function pops the value from the stack. -The assignment is raw; -that is, it does not invoke metamethods. +The assignment is raw, +that is, it does not invoke __newindex metamethod. @@ -4638,7 +4731,7 @@

4.8 – Functions and Types

void lua_register (lua_State *L, const char *name, lua_CFunction f);

-Sets the C function f as the new value of global name. +Sets the C function f as the new value of global name. It is defined as a macro:

@@ -4704,7 +4797,7 @@ 

4.8 – Functions and Types

In case of errors, the stack is not unwound, so you can use the debug API over it. -The error message is on the top of the stack. +The error object is on the top of the stack.

@@ -4859,7 +4952,7 @@

4.8 – Functions and Types

Pops a value from the stack and sets it as -the new value associated to the userdata at the given index. +the new value associated to the full userdata at the given index. @@ -5179,11 +5272,13 @@

4.8 – Functions and Types


lua_version

-[-0, +0, v] +[-0, +0, –]

const lua_Number *lua_version (lua_State *L);

-Returns the address of the version number stored in the Lua core. +Returns the address of the version number +(a C static variable) +stored in the Lua core. When called with a valid lua_State, returns the address of the version used to create that state. When called with NULL, @@ -5271,7 +5366,7 @@

4.8 – Functions and Types

When the coroutine is resumed again, Lua calls the given continuation function k to continue -the execution of the C function that yielded (see §4.7). +the execution of the C function that yielded (see §4.7). This continuation function receives the same stack from the previous function, with the n results removed and @@ -5287,9 +5382,9 @@

4.8 – Functions and Types

it continues executing the continuation function. However, there is one special case, which is when this function is called -from inside a line hook (see §4.9). +from inside a line or a count hook (see §4.9). In that case, lua_yieldk should be called with no continuation -(probably in the form of lua_yield), +(probably in the form of lua_yield) and no results, and the hook should return immediately after the call. Lua will yield and, when the coroutine resumes again, @@ -5484,7 +5579,7 @@

4.9 – The Debug Interface

-To get information about a function you push it onto the stack +To get information about a function, you push it onto the stack and start the what string with the character '>'. (In that case, lua_getinfo pops the function from the top of the stack.) @@ -5704,7 +5799,7 @@

4.9 – The Debug Interface

Argument f is the hook function. mask specifies on which events the hook will be called: -it is formed by a bitwise or of the constants +it is formed by a bitwise OR of the constants LUA_MASKCALL, LUA_MASKRET, LUA_MASKLINE, @@ -5982,7 +6077,7 @@

5.1 – Functions and Types

Raises an error reporting a problem with argument arg -of the C function that called it, +of the C function that called it, using a standard message that includes extramsg as a comment: @@ -6256,7 +6351,7 @@

5.1 – Functions and Types


luaL_checkversion

-[-0, +0, –] +[-0, +0, v]

void luaL_checkversion (lua_State *L);

@@ -6362,7 +6457,7 @@

5.1 – Functions and Types

Pushes onto the stack the field e from the metatable -of the object at index obj and returns the type of pushed value. +of the object at index obj and returns the type of the pushed value. If the object does not have a metatable, or if the metatable does not have this field, pushes nothing and returns LUA_TNIL. @@ -6472,7 +6567,7 @@

5.1 – Functions and Types


luaL_loadfile

-[-0, +1, e] +[-0, +1, m]

int luaL_loadfile (lua_State *L, const char *filename);

@@ -6483,7 +6578,7 @@

5.1 – Functions and Types


luaL_loadfilex

-[-0, +1, e] +[-0, +1, m]

int luaL_loadfilex (lua_State *L, const char *filename,
                                             const char *mode);
@@ -6503,7 +6598,8 @@

5.1 – Functions and Types

This function returns the same results as lua_load, but it has an extra error code LUA_ERRFILE -if it cannot open/read the file or the file has a wrong mode. +for file-related errors +(e.g., it cannot open or read the file).

@@ -6634,6 +6730,27 @@

5.1 – Functions and Types

+

luaL_opt

+[-0, +0, e] +

T luaL_opt (L, func, arg, dflt);
+ +

+This macro is defined as follows: + +

+     (lua_isnoneornil(L,(arg)) ? (dflt) : func(L,(arg)))
+

+In words, if the argument arg is nil or absent, +the macro results in the default dflt. +Otherwise, it results in the result of calling func +with the state L and the argument index arg as +arguments. +Note that it evaluates the expression dflt only if needed. + + + + +


luaL_optinteger

[-0, +0, v]

lua_Integer luaL_optinteger (lua_State *L,
@@ -6675,6 +6792,11 @@ 

5.1 – Functions and Types

its length is considered zero. +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + @@ -6931,7 +7053,7 @@

5.1 – Functions and Types

-If the value has a metatable with a "__tostring" field, +If the value has a metatable with a __tostring field, then luaL_tolstring calls the corresponding metamethod with the value as argument, and uses the result of the call as its result. @@ -7220,7 +7342,7 @@

6.1 – Basic Functions

If object does not have a metatable, returns nil. Otherwise, -if the object's metatable has a "__metatable" field, +if the object's metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object. @@ -7424,7 +7546,7 @@

6.1 – Basic Functions


rawequal (v1, v2)

Checks whether v1 is equal to v2, -without invoking any metamethod. +without invoking the __eq metamethod. Returns a boolean. @@ -7433,7 +7555,7 @@

6.1 – Basic Functions


rawget (table, index)

Gets the real value of table[index], -without invoking any metamethod. +without invoking the __index metamethod. table must be a table; index may be any value. @@ -7444,7 +7566,7 @@

6.1 – Basic Functions


rawlen (v)

Returns the length of the object v, which must be a table or a string, -without invoking any metamethod. +without invoking the __len metamethod. Returns an integer. @@ -7453,7 +7575,7 @@

6.1 – Basic Functions


rawset (table, index, value)

Sets the real value of table[index] to value, -without invoking any metamethod. +without invoking the __newindex metamethod. table must be a table, index any value different from nil and NaN, and value any Lua value. @@ -7489,7 +7611,7 @@

6.1 – Basic Functions

you must use the debug library (§6.10).) If metatable is nil, removes the metatable of the given table. -If the original metatable has a "__metatable" field, +If the original metatable has a __metatable field, raises an error. @@ -7541,7 +7663,7 @@

6.1 – Basic Functions

-If the metatable of v has a "__tostring" field, +If the metatable of v has a __tostring field, then tostring calls the corresponding value with v as argument, and uses the result of the call as its result. @@ -7622,7 +7744,7 @@

6.2 – Coroutine Manipulation

A running coroutine is yieldable if it is not the main thread and -it is not inside a non-yieldable C function. +it is not inside a non-yieldable C function. @@ -7824,8 +7946,8 @@

6.3 – Modules

Lua initializes the C path package.cpath in the same way it initializes the Lua path package.path, -using the environment variable LUA_CPATH_5_3 -or the environment variable LUA_CPATH +using the environment variable LUA_CPATH_5_3, +or the environment variable LUA_CPATH, or a default path defined in luaconf.h. @@ -8184,6 +8306,9 @@

6.4 – String Manipulation

*, h, L, l, n, and p are not supported and that there is an extra option, q. + + +

The q option formats a string between double quotes, using escape sequences when necessary to ensure that it can safely be read back by the Lua interpreter. @@ -8206,7 +8331,12 @@

6.4 – String Manipulation

Options c, d, i, o, u, X, and x expect an integer. -Option q expects a string. +When Lua is compiled with a C89 compiler, +options A and a (hexadecimal floats) +do not support any modifier (flags, width, length). + + +

Option s expects a string; if its argument is not a string, it is converted to one following the same rules of tostring. @@ -8214,12 +8344,6 @@

6.4 – String Manipulation

the string argument should not contain embedded zeros. -

-When Lua is compiled with a non-C99 compiler, -options A and a (hexadecimal floats) -do not support any modifier (flags, width, length). - -

@@ -8380,7 +8504,7 @@

6.4 – String Manipulation

Returns a binary string containing the values v1, v2, etc. packed (that is, serialized in binary form) -according to the format string fmt (see §6.4.2). +according to the format string fmt (see §6.4.2). @@ -8431,7 +8555,8 @@

6.4 – String Manipulation

In particular, the call string.sub(s,1,j) returns a prefix of s with length j, -and string.sub(s, -i) returns a suffix of s +and string.sub(s, -i) (for a positive i) +returns a suffix of s with length i. @@ -8547,6 +8672,14 @@

Character Class:

the lowercase letters plus the '-' character. +

+You can put a closing square bracket in a set +by positioning it as the first character in the set. +You can put a hyphen in a set +by positioning it as the first or the last character in the set. +(You can also use an escape for both cases.) + +

The interaction between ranges and classes is not defined. Therefore, patterns like [%a-z] or [a-%%] @@ -8840,7 +8973,7 @@

6.5 – UTF-8 Support

that start between positions i and j (both inclusive). The default for i is 1 and for j is -1. If it finds any invalid byte sequence, -returns a false value plus the position of the first invalid byte. +returns a false value plus the position of the first invalid byte. @@ -8884,8 +9017,7 @@

6.6 – Table Manipulation

Remember that, whenever an operation needs the length of a table, -the table must be a proper sequence -or have a __len metamethod (see §3.4.7). +all caveats about the length operator apply (see §3.4.7). All functions ignore non-numeric keys in the tables given as arguments. @@ -8925,8 +9057,8 @@

6.6 – Table Manipulation

-Moves elements from table a1 to table a2. -This function performs the equivalent to the following +Moves elements from table a1 to table a2, +performing the equivalent to the following multiple assignment: a2[t],··· = a1[f],···,a1[e]. The default for a2 is a1. @@ -8934,6 +9066,10 @@

6.6 – Table Manipulation

The number of elements to be moved must fit in a Lua integer. +

+Returns the destination table a2. + +

@@ -8941,8 +9077,8 @@

6.6 – Table Manipulation

-Returns a new table with all parameters stored into keys 1, 2, etc. -and with a field "n" with the total number of parameters. +Returns a new table with all arguments stored into keys 1, 2, etc. +and with a field "n" with the total number of arguments. Note that the resulting table may not be a sequence. @@ -8997,9 +9133,8 @@

6.6 – Table Manipulation

-The sort algorithm is not stable; -that is, elements not comparable by the given order -(e.g., equal elements) +The sort algorithm is not stable: +elements considered equal by the given order may have their relative positions changed by the sort. @@ -9075,7 +9210,7 @@

6.7 – Mathematical Functions

Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the +but uses the signs of both arguments to find the quadrant of the result. (It also handles correctly the case of x being zero.) @@ -9335,7 +9470,7 @@

6.7 – Mathematical Functions

Returns a boolean, -true if integer m is below integer n when +true if and only if integer m is below integer n when they are compared as unsigned integers. @@ -9376,7 +9511,7 @@

6.8 – Input and Output Facilities

(plus an error message as a second result and a system-dependent error code as a third result) and some value different from nil on success. -On non-POSIX systems, +In non-POSIX systems, the computation of the error message and error code in case of errors may be not thread safe, @@ -9413,7 +9548,7 @@

6.8 – Input and Output Facilities

and sets its handle as the default input file. When called with a file handle, it simply sets this file handle as the default input file. -When called without parameters, +When called without arguments, it returns the current default input file. @@ -9440,7 +9575,7 @@

6.8 – Input and Output Facilities

The call io.lines() (with no file name) is equivalent to io.input():lines("*l"); that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. +In this case, the iterator does not close the file when the loop ends.

@@ -9457,8 +9592,8 @@

6.8 – Input and Output Facilities

This function opens a file, in the mode specified in the string mode. -It returns a new file handle, -or, in case of errors, nil plus an error message. +In case of success, +it returns a new file handle.

@@ -9523,7 +9658,8 @@

6.8 – Input and Output Facilities

-Returns a handle for a temporary file. +In case of success, +returns a handle for a temporary file. This file is opened in update mode and it is automatically removed when the program ends. @@ -9801,8 +9937,8 @@

6.9 – Operating System Facilities

then date returns a table with the following fields: year, month (1–12), day (1–31), hour (0–23), min (0–59), sec (0–61), -wday (weekday, Sunday is 1), -yday (day of the year), +wday (weekday, 1–7, Sunday is 1), +yday (day of the year, 1–366), and isdst (daylight saving flag, a boolean). This last field may be absent if the information is not available. @@ -9822,7 +9958,7 @@

6.9 – Operating System Facilities

-On non-POSIX systems, +In non-POSIX systems, this function may be not thread safe because of its reliance on C function gmtime and C function localtime. @@ -9920,6 +10056,7 @@

6.9 – Operating System Facilities

with the given name. If this function fails, it returns nil, plus a string describing the error and the error code. +Otherwise, it returns true. @@ -9929,9 +10066,10 @@

6.9 – Operating System Facilities

-Renames file or directory named oldname to newname. +Renames the file or directory named oldname to newname. If this function fails, it returns nil, plus a string describing the error and the error code. +Otherwise, it returns true. @@ -10020,7 +10158,7 @@

6.9 – Operating System Facilities

-On POSIX systems, +In POSIX systems, this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions @@ -10158,8 +10296,8 @@

6.10 – The Debug Library

following the order that they are declared in the code, counting only the variables that are active in the current scope of the function. -Negative indices refer to vararg parameters; --1 is the first vararg parameter. +Negative indices refer to vararg arguments; +-1 is the first vararg argument. The function returns nil if there is no variable with the given index, and raises an error when called with a level out of range. (You can call debug.getinfo to check whether the level is valid.) @@ -10224,7 +10362,7 @@

6.10 – The Debug Library

Returns the Lua value associated to u. -If u is not a userdata, +If u is not a full userdata, returns nil. @@ -10257,7 +10395,7 @@

6.10 – The Debug Library

-When the hook is called, its first parameter is a string +When the hook is called, its first argument is a string describing the event that has triggered its call: "call" (or "tail call"), "return", @@ -10408,7 +10546,8 @@

7 – Lua Standalone

will print "-e". If there is a script, -the script is called with parameters +the script is called with arguments arg[1], ···, arg[#arg]. (Like all chunks in Lua, the script is compiled as a vararg function.) @@ -10504,10 +10643,18 @@

7 – Lua Standalone

by issuing a different prompt. +

+If the global variable _PROMPT contains a string, +then its value is used as the prompt. +Similarly, if the global variable _PROMPT2 contains a string, +its value is used as the secondary prompt +(issued during incomplete statements). + +

In case of unprotected errors in the script, the interpreter reports the error to the standard error stream. -If the error object is not a string but +If the error object is not a string but has a metamethod __tostring, the interpreter calls this metamethod to produce the final message. Otherwise, the interpreter converts the error object to a string @@ -10664,7 +10811,7 @@

8.2 – Changes in the Libraries

frexp, and ldexp. You can replace math.pow(x,y) with x^y; you can replace math.atan2 with math.atan, -which now accepts one or two parameters; +which now accepts one or two arguments; you can replace math.ldexp(x,exp) with x * 2.0^exp. For the other operations, you can either use an external library or @@ -10699,7 +10846,7 @@

8.3 – Changes in the API