summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Updated the documentation for the API function 'lua_gc'v5.4-alphaRoberto Ierusalimschy2019-06-061-53/+62
|
* Detail in makefileRoberto Ierusalimschy2019-06-051-1/+1
|
* Multiple errors in '__toclose' report the first oneRoberto Ierusalimschy2019-06-055-28/+56
| | | | | | | | When there are multiple errors when closing objects, the error reported by the protected call is the first one, for two reasons: First, other errors may be caused by this one; second, the first error is handled in the original execution context, and therefore has the full traceback.
* Function 'warn' is varargRoberto Ierusalimschy2019-06-044-20/+43
| | | | | | | Instead of a 'tocont' flag, the function 'warn' in Lua now receives all message pieces as multiple arguments in a single call. Besides being simpler to use, this implementation ensures that Lua code cannot create unfinished warnings.
* 'coroutine.kill' renamed 'coroutine.close'Roberto Ierusalimschy2019-06-033-28/+29
|
* bug in 5.4 alpha rc1: to-be-closed x vararg functionsRoberto Ierusalimschy2019-06-032-1/+10
| | | | | | Closing methods must be run before correcting 'ci->func' when exiting a vararg function, to get correct debug information (e.g., in case of errors).
* DetailsRoberto Ierusalimschy2019-06-038-23/+23
| | | | | Several small changes from feedback on 5.4 alhpa rc1 (warnings, typos in the manual, and the like)
* Improvements in 'testes/cstack.lua'Roberto Ierusalimschy2019-06-031-12/+32
| | | | | | - tests show progress in real time, so that we can see maximum stack levels even if test crashes. - new test for recursion continuing into message handler.
* Improvements in 'luaL_traceback'Roberto Ierusalimschy2019-05-281-24/+29
| | | | | | | | 'luaL_traceback' changed to use an aux buffer instead of concats. This should reduce the quantity of garbage it generates (in the form of intermediate strings) while producing a trackback. It also added information about the number of levels skipped when skipping levels in a trace.
* DetailsRoberto Ierusalimschy2019-05-289-23/+46
| | | | | | | - new error message for "attempt to assign to const variable" - note in the manual about compatibility options - comments - small changes in 'read_line' and 'pushstr'
* First implementation for 'const' variablesRoberto Ierusalimschy2019-05-177-56/+205
| | | | | A variable can be declared const, which means it cannot be assigned to, with the syntax 'local <const> name = exp'.
* Define LUA_MAXUNSIGNED as a preprocessor constantRoberto Ierusalimschy2019-05-142-3/+10
| | | | | The previous definition of LUA_MAXUNSIGNED used a typecast, making it unsuitable for constant expressions in the preprocessor.
* DetailsRoberto Ierusalimschy2019-05-135-11/+13
| | | | | | - 'luaL_setfuncs' avoids creating closures for placeholders. - Fixed some warnings about unused values in comma expressions. - Comments.
* A few changes in tests about number of bits in integersRoberto Ierusalimschy2019-05-136-18/+19
| | | | | | - The preprocessor must work with at least 'long', and therefore must do shifts of up to 31 bits correctly. - Whenever possible, use unsigned types in shifts.
* Some improvements in 'luaconf.h'Roberto Ierusalimschy2019-05-133-36/+65
| | | | | Added '#if !defined' in some definitions to allow external definitions; more comments; other small changes.
* Flag for to-be-closed variables changed to '<toclose>'Roberto Ierusalimschy2019-05-098-38/+40
| | | | | | | The flag for to-be-closed variables was changed from '*toclose' to '<toclose>'. Several people found confusing the old syntax and the new one has a clear terminator, making it more flexible for future changes.
* Test for dead coroutine moved to 'lua_resume'Roberto Ierusalimschy2019-05-092-4/+2
| | | | | | The test for dead coroutines done in the 'coro' library was moved to 'lua_resume', in the kernel, which already does other similar tests.
* Coroutines do not unwind the stack in case of errorsRoberto Ierusalimschy2019-05-096-26/+80
| | | | | | | | | | | Back to how it was, a coroutine does not unwind its stack in case of errors (and therefore do not close its to-be-closed variables). This allows the stack to be examined after the error. The program can use 'coroutine.kill' to close the variables. The function created by 'coroutine.wrap', however, closes the coroutine's variables in case of errors, as it is impossible to examine the stack any way.
* File 'lib2-v2.so' generated from its own sourceRoberto Ierusalimschy2019-05-033-3/+28
| | | | | Instead of being a copy of 'lib2.so', 'lib2-v2.so' has its own source file ('lib22.c'), so that the test can distinguish both libraries.
* A few more improvements in 'luaO_pushvfstring'Roberto Ierusalimschy2019-05-034-35/+52
| | | | | | | | - 'L' added to the 'BuffFS' structure - '%c' does not handle control characters (it is not its business. This now is done by the lexer, who is the one in charge of that kind of errors.) - avoid the direct use of 'l_sprintf' in the Lua kernel
* Avoid the creation of too many strings in 'package'Roberto Ierusalimschy2019-05-034-41/+79
| | | | | | | | | Both when setting a path and searching for a file ('searchpath'), this commit reduces the number of intermediate strings created in Lua. (For setting a path the change is not relevant, because this is done only twice when loading the module. Anyway, it is a nice example of how to use auxlib buffers to manipulate strings in the C API.)
* Some more small improvements to 'luaO_pushvfstring'Roberto Ierusalimschy2019-04-262-54/+71
| | | | | | | Details: - counter 'pushed' moved to the struct 'BuffFS' - new auxiliar function 'getbuff' to build strings directly on the buffer.
* Fixed bug with to-be-closed variables in base C levelRoberto Ierusalimschy2019-04-261-0/+2
| | | | | | | | To-be-closed variables in C use 'ci.nresults' to code that there is a variable to be closed in that function. The intialization of the base C level (the one "running" when calling API functions outside any Lua call) did not initialize 'ci.nresults', creating (correct) warnings in valgrind.
* New function 'luaL_addgsub'Roberto Ierusalimschy2019-04-243-13/+58
| | | | | | | | Added a new function 'luaL_addgsub', similar to 'luaL_gsub' but that adds its result directly to a preexisting buffer, avoiding the creation of one extra intermediate string. Also added two simple macros, 'luaL_bufflen' and 'luaL_buffaddr', to query the current length and the contents address of a buffer.
* Revamp of 'lua_pushfstring' / 'luaO_pushvfstring'Roberto Ierusalimschy2019-04-244-44/+177
| | | | | | | | | The function 'luaO_pushvfstring' now uses an internal buffer to concatenate small strings, instead of pushing all pieces on the stack. This avoids the creation of several small Lua strings for each piece of the result. (For instance, a format like "n: '%d'" used to create three intermediate strings: "n: '", the numeral, and "'". Now it creates none.)
* Small correction in test about 'isdst'Roberto Ierusalimschy2019-04-221-1/+1
| | | | | The field 'isdst' can be false, so we cannot test its absence with 'if not D.isdst'; we must compare with nil for a correct test.
* 'require' returns where module was foundRoberto Ierusalimschy2019-04-174-34/+66
| | | | | The function 'require' returns the *loader data* as a second result. For file searchers, this data is the path where they found the module.
* Avoid using large buffers in 'string.format'Roberto Ierusalimschy2019-04-122-20/+29
| | | | | | | The result of "string.format("%.99f", -1e308) is 410 characters long, but all other formats have much smaller limits (at most 99 plus a fex extras). This commit avoids 'string.format' asking for a buffer ~400 chars large when ~100 will do.
* Small optimizations in 'string.gsub'Roberto Ierusalimschy2019-04-113-47/+115
| | | | | | | | | | | Avoid creating extra strings when possible: - avoid creating new resulting string when subject was not modified (instead, return the subject itself); - avoid creating strings representing the captured substrings when handling replacements like '%1' (instead, add the substring directly to the buffer).
* Added an optional parameter to 'coroutine.isyieldable'Roberto Ierusalimschy2019-04-103-6/+11
|
* 'print' does not call 'tostring' to format its argumentsRoberto Ierusalimschy2019-04-103-28/+16
|
* Thorough revision of the reference manualRoberto Ierusalimschy2019-04-101-341/+351
|
* Corrected tests around non-portable 'isdst' in datesRoberto Ierusalimschy2019-04-091-3/+7
| | | | | The field 'isdst' in date tables may not be present; portable tests should not assume it is.
* Syntax should not allow numbers touching identifiersRoberto Ierusalimschy2019-04-092-0/+11
| | | | Code like 'a = 1print()' should not be accepted.
* Fixed wrong error message in 'return math.seed(0)'Roberto Ierusalimschy2019-04-043-5/+11
| | | | | | Bug introduced in commit 28d829c8: OP_TAILCALL might raise an error without saving 'pc'. (This commit also fixes a detail in 'testes/uf8.lua'.)
* Added field 'srclen' to structure 'lua_Debug'Roberto Ierusalimschy2019-04-046-20/+31
| | | | | | This new field gets the length of 'source' in the same structure. Unlike the other strings in that structure, 'source' can be relatively large, and Lua already has its length readily available.
* Avoid moving the collector while in 'GCSenteratomic' stateRoberto Ierusalimschy2019-04-011-2/+2
| | | | | | The 'GCSenteratomic' is just an auxiliary state for transitioning to 'GCSatomic'. All GC traversals should be done either on the 'GCSpropagate' state or the 'GCSatomic' state.
* Small optimizations in range checksRoberto Ierusalimschy2019-03-274-11/+20
| | | | | | | | Checks of the form '1 <= x && x <= M' were rewritten in the form '(unsigned)x - 1 < (unsigned)M', which is usually more efficient. (Other similar checks have similar translations.) Although some compilers do these optimizations, that does not happen for all compilers or all cases.
* LUAI_MAXCCALLS renamed LUAI_MAXCSTACKRoberto Ierusalimschy2019-03-255-21/+27
| | | | | | | The limit LUAI_MAXCCALLS was renamed LUAI_MAXCSTACK, which better represents its meaning. Moreover, its definition was moved to 'luaconf.h', given its importance now that Lua does not use a "stackless" implementation.
* Year in copyright notice updated to 2019Roberto Ierusalimschy2019-03-252-3/+3
|
* Fixed small bugs/issuesRoberto Ierusalimschy2019-03-252-5/+9
| | | | | | | | | | | | | - In 'readutf8esc' (llex.c), the overflow check must be done before shifting the accumulator. It was working because tests were using 64-bit longs. Failed with 32-bit longs. - In OP_FORPREP (lvm.c), avoid negating an unsigned value. Visual Studio gives a warning for that operation, despite being well defined in ISO C. - In 'luaV_execute' (lvm.c), 'cond' can be defined only when needed, like all other variables.
* Keep correct type for immediate operands in comparisonsRoberto Ierusalimschy2019-03-2213-134/+237
| | | | | | | | | | | | When calling metamethods for things like 'a < 3.0', which generates the opcode OP_LTI, the C register tells that the operand was converted to an integer, so that it can be corrected to float when calling a metamethod. This commit also includes some other stuff: - file 'onelua.c' added to the project - opcode OP_PREPVARARG renamed to OP_VARARGPREP - comparison opcodes rewritten through macros
* Details in the implementation of the integer 'for' loopRoberto Ierusalimschy2019-03-212-44/+49
| | | | | | | | Changed some implementation details; in particular, it is back using an internal variable to keep the index, with the control variable being only a copy of that internal variable. (The direct use of the control variable demands a check of its type for each access, which offsets the gains from the use of a single variable.)
* Small changes in the header of binary filesRoberto Ierusalimschy2019-03-194-31/+34
| | | | | | | | | - LUAC_VERSION is equal to LUA_VERSION_NUM, and it is stored as an int. - 'sizeof(int)' and 'sizeof(size_t)' removed from the header, as the binary format does not depend on these sizes. (It uses its own serialization for unsigned integer values.)
* Name 'nonstrict' in the UTF-8 library changed to 'lax'Roberto Ierusalimschy2019-03-192-13/+13
| | | | | It is not a good idea to use negative words to describe boolean values. (When we negate that boolean we create a double negative...)
* New semantics for the integer 'for' loopRoberto Ierusalimschy2019-03-1910-187/+215
| | | | | | | | | | | 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-156-72/+164
| | | | | | | | | | | 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-142-5/+20
| | | | | 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-1412-98/+79
| | | | | | | | - 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-133-20/+36
| | | | | | 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.