aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Simpler code for 'traversetable'Roberto Ierusalimschy2025-06-162-13/+31
| | | | | Check the mode in a separate function (getmode), instead of using comma expressions inside the 'if' condition.
* Dump uses varints also for integer constantsRoberto Ierusalimschy2025-06-133-18/+48
| | | | | | Unlike sizes, these constants can be negative, so it encodes those integers into unsigned integers in a way that keeps small numbers small.
* The main thread cannot be closedRoberto Ierusalimschy2025-06-133-2/+10
| | | | | | No thread started with pcall (instead of resume) can be closed, because coroutine.close would not respect the expected number of results from the protected call.
* A coroutine can close itselfRoberto Ierusalimschy2025-06-126-21/+103
| | | | | A call to close itself will close all its to-be-closed variables and return to the resume that (re)started the coroutine.
* Loading a binary chunk should not break assertionsRoberto Ierusalimschy2025-06-042-1/+4
| | | | | Although the execution of a bad binary chunk can crash the interpreter, simply loading it should be safe.
* Removed uneeded check in parserRoberto Ierusalimschy2025-06-041-1/+0
| | | | | | | | | In a constructor, each field generates at least one opcode, and the number of opcodes is limited by INT_MAX. Therefore, the counters for number of fields cannot exceed this limit. (The current limit for items in the hash part of a table has a limit smaller than INT_MAX. However, as long as there are no overflows, the logic for table resizing will handle that limit.)
* Bug: check for constructor overflow in [exp] fieldsRoberto Ierusalimschy2025-05-202-6/+5
| | | | | The check for constructor overflow was considering only fields with explicit names, ignoring fields with syntax '[exp]=exp'.
* New way to control preambular declarationRoberto Ierusalimschy2025-05-204-15/+45
| | | | | Validity of the preambular global declaration in controled together with all declarations, when checking variable names.
* Proper error message when jumping into 'global *'Roberto Ierusalimschy2025-05-183-9/+12
| | | | | | A goto cannot jump into the scope of any variable declaration, including 'global *'. To report the error, it needs a "name" for the scope it is entering.
* Variable attributes can prefix name listRoberto Ierusalimschy2025-05-1815-60/+84
| | | | | In this format, the attribute applies to all names in the list; e.g. "global<const> print, require, math".
* DetailRoberto Ierusalimschy2025-05-162-8/+7
| | | | | Reports errors with "?:?:" (instead of "?:-1:") when there is no debug information.
* Slightly faster way to check for "global"Roberto Ierusalimschy2025-05-163-12/+13
|
* Internalized string "break" kept by the parserRoberto Ierusalimschy2025-05-153-3/+7
| | | | | | The parser uses "break" as fake label to compile "break" as "goto break". To avoid producing this string at each use, it keeps it available in its state.
* Remove compat code in parser when not neededRoberto Ierusalimschy2025-05-132-2/+5
|
* Collective declaration for globals ('global *')Roberto Ierusalimschy2025-05-1314-63/+155
|
* Correct line in error message for constant functionRoberto Ierusalimschy2025-05-122-1/+8
|
* 'expdesc' doesn't depend on 'actvar' for var. info.Roberto Ierusalimschy2025-05-113-17/+23
| | | | | In preparation for 'global *', the structure 'expdesc' does not point to 'actvar.arr' for information about global variables.
* Janitorial work on castsRoberto Ierusalimschy2025-05-088-44/+47
|
* Using 'l_uint32' for unicode codepoints in scannerRoberto Ierusalimschy2025-05-084-7/+7
| | | | | 'l_uint32' is enough for unicode codepoints (versus unsigned long), and the utf-8 library already uses that type.
* New syntax 'global function'Roberto Ierusalimschy2025-05-084-13/+82
|
* Checks for read-only globalsRoberto Ierusalimschy2025-05-064-9/+33
|
* First implementation of global declarationsRoberto Ierusalimschy2025-05-0510-117/+272
|
* New macro 'pushvfstring'Roberto Ierusalimschy2025-04-234-16/+13
| | | | | Helps to ensure that 'luaO_pushvfstring' is being called correctly, with an error check after closing the vararg list with 'va_end'.
* Details (typos in comments)Roberto Ierusalimschy2025-04-2316-30/+29
|
* Function 'luaK_semerror' made varargRoberto Ierusalimschy2025-04-173-20/+21
| | | | | All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create the error messages.
* In gen. GC, some gray objects stay in gray listsRoberto Ierusalimschy2025-04-152-2/+9
| | | | | | In generational collection, objects marked as touched1 stay in gray lists between collections. This commit fixes a bug introduced in commit 808976bb59.
* Order change in 'pushfuncname'Roberto Ierusalimschy2025-04-032-7/+7
| | | | | 'pushglobalfuncname' can be quite slow (as it traverses all globals and all loaded modules), so try first to get a name from the code.
* Tiny refactoring in io.flushRoberto Ierusalimschy2025-04-032-7/+25
|
* io.write returns number of written bytes on errorRoberto Ierusalimschy2025-04-034-7/+65
|
* Corrections of stack addresses back to strict modeRoberto Ierusalimschy2025-04-012-3/+3
| | | | | | It can be a little slower, but only for quite large stacks and moreover stack reallocation is not a common operation. With no strong contrary reason, it is better to follow the standard.
* Growth factor of 1.5 for stack and lexical bufferRoberto Ierusalimschy2025-03-313-11/+11
|
* Small optimization in 'project' from math.randomRoberto Ierusalimschy2025-03-271-21/+9
| | | | | | When computing the Mersenne number, instead of spreading 1's a fixed number of times (with shifts of 1, 2, 4, 8, 16, and 32), spread only until the number becomes a Mersenne number.
* New macro 'l_numbits'Roberto Ierusalimschy2025-03-276-15/+9
|
* Addition in math.random can overflowRoberto Ierusalimschy2025-03-251-2/+2
| | | | | | To avoid complains from some tools, the addition when computing math.random(n,m), which is computed as n + random(0, m - n), should use unsigned integers.
* DetailsRoberto Ierusalimschy2025-03-242-25/+28
| | | | | | Small changes in test library: - execute mode added to 'all.lua'; - more information about subtypes (tags) when printing a stack.
* Detail in the manualRoberto Ierusalimschy2025-03-171-6/+8
|
* New function 'resetCI'Roberto Ierusalimschy2025-03-172-19/+39
| | | | | | | | New function 'resetCI' resets the CallInfo list of a thread, ensuring a proper state when creating a new thread, closing a thread, or closing a state, so that we can run code after that. (When closing a thread, we need to run its __close metamethods; when closing a state, we need to run its __close metamethods and its finalizers.)
* New function 'printallstack' in test libraryRoberto Ierusalimschy2025-03-172-0/+24
|
* Wrong error message when using "_ENV" fieldsRoberto Ierusalimschy2025-03-143-6/+16
| | | | | The string "_ENV" is erroneously identified as a variable _ENV, so that results from a field is classified as a global.
* Missing GC barrier in 'luaV_finishset'Roberto Ierusalimschy2025-03-143-3/+19
|
* Use after free in 'luaV_finishset'Roberto Ierusalimschy2025-03-133-1/+25
| | | | | | If a metatable is a weak table, its __newindex field could be collected by an emergency collection while being used in 'luaV_finishset'. (This bug has similarities with bug 5.3.2-1, fixed in commit a272fa66.)
* 'luaD_seterrorobj' should not raise errorsRoberto Ierusalimschy2025-03-125-22/+25
| | | | | | This function can be called unprotected, so it should not raise any kind of errors. (It could raise a memory-allocation error when creating a message).
* Small changes in the manualRoberto Ierusalimschy2025-03-121-16/+22
|
* Removed copyright notice from 'testes/all.lua'Roberto Ierusalimschy2025-03-1232-60/+33
| | | | All test files refer to the main copyright notice in 'lua.h'.
* New test file 'memerr.lua'Roberto Ierusalimschy2025-03-124-243/+268
| | | | | | Tests for memory-allocation errors moved from 'api.lua' to this new file, as 'api.lua' was already too big. (Besides, these tests have nothing to do with the API.)
* Small correction in 'traverseweakvalue'Roberto Ierusalimschy2025-03-121-3/+3
| | | | | | After a weak table is traversed in the atomic phase, if it does not have white values ('hasclears') it does not need to be retraversed again. (Comments were correct, but code did not agree with them.)
* Checks for type 'int' added to binary headerRoberto Ierusalimschy2025-03-104-36/+67
| | | | | The structure 'AbsLineInfo' is hard-dumped into binary chunks, and it comprises two 'int' fields.
* DetailRoberto Ierusalimschy2025-02-281-0/+4
| | | | | Added macro LUA_FAILISFALSE to make easier to change the fail value from nil to false.
* Error object cannot be nilRoberto Ierusalimschy2025-02-284-8/+23
| | | | | Lua will change a nil as error object to a string message, so that it never reports an error with nil as the error object.
* '__close' gets no error object if there is no errorRoberto Ierusalimschy2025-02-284-27/+60
| | | | | Instead of receiving nil as a second argument, __close metamethods are called with just one argument when there are no errors.