Roberto Ierusalimschy
be05c44481
New way to control preambular declaration
...
Validity of the preambular global declaration in controled together
with all declarations, when checking variable names.
2025-05-20 17:36:05 -03:00
Roberto Ierusalimschy
6d53701c7a
Proper error message when jumping into 'global *'
...
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.
2025-05-18 12:03:54 -03:00
Roberto Ierusalimschy
abbae57c78
Variable attributes can prefix name list
...
In this format, the attribute applies to all names in the list;
e.g. "global<const> print, require, math".
2025-05-18 11:43:43 -03:00
Roberto Ierusalimschy
f2c1531e6c
Detail
...
Reports errors with "?:?:" (instead of "?👎 ") when there is no debug
information.
2025-05-16 15:20:32 -03:00
Roberto Ierusalimschy
ded2ad2d86
Slightly faster way to check for "global"
2025-05-16 14:51:07 -03:00
Roberto Ierusalimschy
3fb7a77731
Internalized string "break" kept by the parser
...
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.
2025-05-15 12:43:37 -03:00
Roberto Ierusalimschy
fded0b4a84
Remove compat code in parser when not needed
2025-05-13 11:50:43 -03:00
Roberto Ierusalimschy
3b9dd52be0
Collective declaration for globals ('global *')
2025-05-13 11:43:10 -03:00
Roberto Ierusalimschy
7dc6aae290
Correct line in error message for constant function
2025-05-12 11:42:45 -03:00
Roberto Ierusalimschy
5b1ab8efdc
'expdesc' doesn't depend on 'actvar' for var. info.
...
In preparation for 'global *', the structure 'expdesc' does not point
to 'actvar.arr' for information about global variables.
2025-05-11 11:51:58 -03:00
Roberto Ierusalimschy
7ade155762
Janitorial work on casts
2025-05-08 15:18:57 -03:00
Roberto Ierusalimschy
d827e96f33
Using 'l_uint32' for unicode codepoints in scanner
...
'l_uint32' is enough for unicode codepoints (versus unsigned long),
and the utf-8 library already uses that type.
2025-05-08 12:49:39 -03:00
Roberto Ierusalimschy
3f0ea90aa8
New syntax 'global function'
2025-05-08 11:08:03 -03:00
Roberto Ierusalimschy
4365a45d68
Checks for read-only globals
2025-05-06 15:54:05 -03:00
Roberto Ierusalimschy
be81209063
First implementation of global declarations
2025-05-05 16:24:59 -03:00
Roberto Ierusalimschy
e055905914
New macro 'pushvfstring'
...
Helps to ensure that 'luaO_pushvfstring' is being called correctly,
with an error check after closing the vararg list with 'va_end'.
2025-04-23 11:55:04 -03:00
Roberto Ierusalimschy
9b014d4bcd
Details (typos in comments)
2025-04-23 11:36:09 -03:00
Roberto Ierusalimschy
50fd8d03c3
Function 'luaK_semerror' made vararg
...
All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create
the error messages.
2025-04-17 14:58:55 -03:00
Roberto Ierusalimschy
3dbb1a4b89
In gen. GC, some gray objects stay in gray lists
...
In generational collection, objects marked as touched1 stay in gray
lists between collections. This commit fixes a bug introduced in
commit 808976bb59 .
2025-04-15 17:00:30 -03:00
Roberto Ierusalimschy
3dd8ea54da
Order change in 'pushfuncname'
...
'pushglobalfuncname' can be quite slow (as it traverses all globals and
all loaded modules), so try first to get a name from the code.
2025-04-03 15:31:22 -03:00
Roberto Ierusalimschy
620f49a7aa
Tiny refactoring in io.flush
2025-04-03 12:56:52 -03:00
Roberto Ierusalimschy
3f4f28010a
io.write returns number of written bytes on error
2025-04-03 11:32:49 -03:00
Roberto Ierusalimschy
93e347b519
Corrections of stack addresses back to strict mode
...
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.
2025-04-01 10:41:25 -03:00
Roberto Ierusalimschy
f4123b2fc2
Growth factor of 1.5 for stack and lexical buffer
2025-03-31 13:44:41 -03:00
Roberto Ierusalimschy
37a1b72706
Small optimization in 'project' from math.random
...
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.
2025-03-27 15:22:40 -03:00
Roberto Ierusalimschy
ef5d171cc8
New macro 'l_numbits'
2025-03-27 12:38:29 -03:00
Roberto Ierusalimschy
b0f3df16a4
Addition in math.random can overflow
...
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.
2025-03-25 11:43:03 -03:00
Roberto Ierusalimschy
cad5a4fdbb
Details
...
Small changes in test library:
- execute mode added to 'all.lua';
- more information about subtypes (tags) when printing a stack.
2025-03-24 15:23:55 -03:00
Roberto Ierusalimschy
fdbb4c2341
Detail in the manual
2025-03-17 16:05:47 -03:00
Roberto Ierusalimschy
921832be8d
New function 'resetCI'
...
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.)
2025-03-17 14:32:08 -03:00
Roberto Ierusalimschy
205f9aa67b
New function 'printallstack' in test library
2025-03-17 14:30:43 -03:00
Roberto Ierusalimschy
94d38560c3
Wrong error message when using "_ENV" fields
...
The string "_ENV" is erroneously identified as a variable _ENV,
so that results from a field is classified as a global.
2025-03-14 15:16:09 -03:00
Roberto Ierusalimschy
c2dc6e8e94
Missing GC barrier in 'luaV_finishset'
2025-03-14 12:37:19 -03:00
Roberto Ierusalimschy
22974326ca
Use after free in 'luaV_finishset'
...
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.)
2025-03-13 15:30:52 -03:00
Roberto Ierusalimschy
c931d86e98
'luaD_seterrorobj' should not raise errors
...
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).
2025-03-12 15:51:16 -03:00
Roberto Ierusalimschy
d9e0f64a5d
Small changes in the manual
2025-03-12 15:45:39 -03:00
Roberto Ierusalimschy
ab66652b32
Removed copyright notice from 'testes/all.lua'
...
All test files refer to the main copyright notice in 'lua.h'.
2025-03-12 14:00:58 -03:00
Roberto Ierusalimschy
4398e488e6
New test file 'memerr.lua'
...
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.)
2025-03-12 13:52:35 -03:00
Roberto Ierusalimschy
808976bb59
Small correction in 'traverseweakvalue'
...
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.)
2025-03-12 12:35:36 -03:00
Roberto Ierusalimschy
b5b1995f29
Checks for type 'int' added to binary header
...
The structure 'AbsLineInfo' is hard-dumped into binary chunks, and
it comprises two 'int' fields.
2025-03-10 15:21:32 -03:00
Roberto Ierusalimschy
cb88c1cd5d
Detail
...
Added macro LUA_FAILISFALSE to make easier to change the fail value
from nil to false.
2025-02-28 15:48:45 -03:00
Roberto Ierusalimschy
ee99452158
Error object cannot be nil
...
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.
2025-02-28 14:53:58 -03:00
Roberto Ierusalimschy
127a8e80fe
'__close' gets no error object if there is no error
...
Instead of receiving nil as a second argument, __close metamethods are
called with just one argument when there are no errors.
2025-02-28 10:10:27 -03:00
Roberto Ierusalimschy
f9e35627ed
'lua_State.nci' must be an integer
...
Lua can easily overflow an unsigned short counting nested calls.
(The limit to this value is the maximum stack size, LUAI_MAXSTACK,
which is currently 1e6.)
2025-02-26 11:31:10 -03:00
Roberto Ierusalimschy
ceac82f78b
Details
...
Comments, small changes in the manual, an extra test for errors in
error handling, small changes in tests.
2025-02-26 11:29:54 -03:00
Roberto Ierusalimschy
e5f4927a0b
Array sizes in undump changed from unsigned to int
...
Array sizes are always int and are dumped as int, so there is no reason
to read them back as unsigned.
2025-02-20 10:09:04 -03:00
Roberto Ierusalimschy
cd38fe8cf3
Added macro LUAI_STRICT_ADDRESS
...
By default, the code assumes it is safe to use a dealocated pointer
as long as the code does not access it.
2025-02-18 17:02:32 -03:00
Roberto Ierusalimschy
fa1382b5cd
Main thread is a regular field of global_State
...
They were already allocated as a single block, so there is no need
for the global_State to point to its main thread.
2025-01-31 13:51:38 -03:00
Roberto Ierusalimschy
d1e677c52b
New type 'TStatus' for thread status/error codes
2025-01-30 11:41:39 -03:00
Roberto Ierusalimschy
f7439112a5
Details (in test library)
...
- Added support for negative stack indices in the "C interpreter"
- Improved format when printing values
2025-01-29 14:47:06 -03:00