aboutsummaryrefslogtreecommitdiff
path: root/manual (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* New semantics for the integer 'for' loopRoberto Ierusalimschy2019-03-191-70/+54
| | | | | | | | | | | The numerical 'for' loop over integers now uses a precomputed counter to control its number of iteractions. This change eliminates several weird cases caused by overflows (wrap-around) in the control variable. (It also ensures that every integer loop halts.) Also, the special opcodes for the usual case of step==1 were removed. (The new code is already somewhat complex for the usual case, but efficient.)
* Changes in the validation of UTF-8Roberto Ierusalimschy2019-03-151-4/+39
| | | | | | | | | | | All UTF-8 encoding functionality (including the escape sequence '\u') accepts all values from the original UTF-8 specification (with sequences of up to six bytes). By default, the decoding functions in the UTF-8 library do not accept invalid Unicode code points, such as surrogates. A new parameter 'nonstrict' makes them accept all code points up to (2^31)-1, as in the original UTF-8 specification.
* Finalizers must be callableRoberto Ierusalimschy2019-03-141-4/+19
| | | | | Non-function __gc metamethods are not ignored; if present, the metamethod will be called even if it is not a function.
* Changes in the warning systemRoberto Ierusalimschy2019-03-141-13/+13
| | | | | | | | - The warning functions get an extra parameter that tells whether message is to be continued (instead of using end-of-lines as a signal). - The user data for the warning function is a regular value, instead of a writable slot inside the Lua state.
* 'math.randomseed()' sets a somewhat random seedRoberto Ierusalimschy2019-03-131-9/+14
| | | | | | When called with no arguments, 'math.randomseed' uses time and ASLR to generate a somewhat random seed. the initial seed when Lua starts is generated this way.
* New conversion specifier '%p' for 'string.format'Roberto Ierusalimschy2019-03-131-3/+10
| | | | | The call 'string.format("%p", val)' gives a Lua equivalent to the C API function 'lua_topointer'.
* DetailsRoberto Ierusalimschy2019-03-131-22/+32
| | | | | | | | | | Several small improvements (code style, warnings, comments, more tests), in particular: - 'lua_topointer' extended to handle strings - raises an error in 'string.format("%10q")' ('%q' with modifiers) - in the manual for 'string.format', the term "option" replaced by "conversion specifier" (the term used by the C standard)
* Optional 'init' argument to 'string.gmatch'Roberto Ierusalimschy2019-01-081-19/+23
| | | | | | | | | The function 'string.gmatch' now has an optional 'init' argument, similar to 'string.find' and 'string.match'. Moreover, there was some reorganization in the manipulation of indices in the string library. This commit also includes small janitorial work in the manual and in comments in the interpreter loop.
* No more to-be-closed functionsRoberto Ierusalimschy2019-01-041-20/+14
| | | | | | | | | | | | | | | | | | | To-be-closed variables must contain objects with '__toclose' metamethods (or nil). Functions were removed for several reasons: * Functions interact badly with sandboxes. If a sandbox raises an error to interrupt a script, a to-be-closed function still can hijack control and continue running arbitrary sandboxed code. * Functions interact badly with coroutines. If a coroutine yields and is never resumed again, its to-be-closed functions will never run. To-be-closed objects, on the other hand, will still be closed, provided they have appropriate finalizers. * If you really need a function, it is easy to create a dummy object to run that function in its '__toclose' metamethod. This comit also adds closing of variables in case of panic.
* No more LUA_ERRGCMM errorsRoberto Ierusalimschy2019-01-011-17/+9
| | | | | Errors in finalizers (__gc metamethods) are never propagated. Instead, they generate a warning.
* Added a warning system to LuaRoberto Ierusalimschy2018-12-281-8/+48
| | | | | The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program.
* DetailsRoberto Ierusalimschy2018-12-171-8/+8
| | | | | A few details in the makefile and in the manual. (In particular, it updates the dependency lists in the makefile.)
* New functions 'lua_resetthread' and 'coroutine.kill'Roberto Ierusalimschy2018-12-131-4/+30
| | | | | | New functions to reset/kill a thread/coroutine, mainly (only?) to close any pending to-be-closed variable. ('lua_resetthread' also allows a thread to be reused...)
* Better error messages for some polymorphic functionsRoberto Ierusalimschy2018-12-101-0/+26
| | | | | | | | | New auxiliary functions/macros 'luaL_argexpected'/'luaL_typeerror' ease the creation of error messages such as bad argument #2 to 'setmetatable' (nil or table expected, got boolean) (The novelty being the "got boolean" part...)
* Calls cannot be tail in the scope of a to-be-closed variableRoberto Ierusalimschy2018-12-041-9/+8
| | | | | | A to-be-closed variable must be closed when a block ends, so even a 'return foo()' cannot directly returns the results of 'foo'; the function must close the scope before returning.
* A to-be-closed variable must have a closable value (or be nil)Roberto Ierusalimschy2018-11-291-9/+16
| | | | | | | It is an error for a to-be-closed variable to have a non-closable non-nil value when it is being closed. This situation does not seem to be useful and often hints to an error. (Particularly in the C API, it is easy to change a to-be-closed index by mistake.)
* Documentation for to-be-closed variablesRoberto Ierusalimschy2018-11-131-26/+122
|
* Removed resource-related "emergency collections"Roberto Ierusalimschy2018-10-311-14/+0
| | | | | New to-be-closed variables is a better way to ensure the proper release of resources.
* Small improvements in the manualRoberto Ierusalimschy2018-10-221-8/+18
|
* Deprecated the emulation of '__le' using '__lt'Roberto Ierusalimschy2018-08-241-12/+9
| | | | | | | | | | | As hinted in the manual for Lua 5.3, the emulation of the metamethod for '__le' using '__le' has been deprecated. It is slow, complicates the logic, and it is easy to avoid this emulation by defining a proper '__le' function. Moreover, often this emulation was used wrongly, with a programmer assuming that an order is total when it is not (e.g., NaN in floating-point numbers).
* Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'Roberto Ierusalimschy2018-07-271-0/+14
| | | | | | | | These operations also can give errors for lack of resources, so they also will try "emergency collections" in case of resource errors. Because there are now two libraries with that kind of handling, 'resourcetryagain' was moved to the auxiliary library to be shared by the libraries.
* Small improvements in the manualRoberto Ierusalimschy2018-07-251-5/+7
|
* Improvements in the manualRoberto Ierusalimschy2018-07-101-14/+17
| | | | | | - More precise use of 'argument' x 'parameter'. - Clarification about what the lexer considers 'letter', 'space', and 'digit'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-092-0/+9222