Commit Graph

148 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
50c7c915ee Debug information about extra arguments from __call
'debug.getinfo' can return number of extra arguments added to a call by
a chain of __call metavalues. That information is being used to improve
error messages about errors in these extra arguments.
2024-11-19 14:09:18 -03:00
Roberto Ierusalimschy
b117bdb344 Counter for length of chains of __call metamethods
This counter will allow (in a later commit) error messages to correct
argument numbers in functions called through __call metamethods.
2024-11-16 12:00:28 -03:00
Roberto Ierusalimschy
e3ce88c9e8 New function 'lua_numbertostrbuff'
It converts a Lua number to a string in a buffer, without creating
a new Lua string.
2024-10-23 17:16:17 -03:00
Roberto Ierusalimschy
d0815046d0 Some adjustments in transition minor->major
Plus extra comments and other details.
2024-10-18 17:10:20 -03:00
Roberto Ierusalimschy
3d54b42d59 'objsize' broke in smaller pieces 2024-09-30 14:01:42 -03:00
Roberto Ierusalimschy
20d42ccaae No errors in 'luaO_pushvfstring'
Any call to 'va_start' must have a corresponding call to 'va_end';
so, functions called between them (luaO_pushvfstring in particular)
cannot raise errors.
2024-09-20 15:56:39 -03:00
Roberto Ierusalimschy
4901853c11 Parameter for lua_gc/LUA_GCSTEP changed to 'size_t'
'size_t' is the common type for measuring memory. 'int' can be too
small for steps.
2024-09-10 17:05:39 -03:00
Roberto Ierusalimschy
0acd55898d Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative
numerical types.
2024-07-27 13:32:59 -03:00
Roberto Ierusalimschy
a546138d15 Explicit limit for number of results in a call
The parameter 'nresults' in 'lua_call' and similar functions has a
limit of 250. It already had an undocumented (and unchecked) limit of
SHRT_MAX, but it is seldom larger than 2.
2024-07-18 14:44:40 -03:00
Roberto Ierusalimschy
cd4de92762 Maximum stack size may not fit in unsigned short
Therefore, fields ftransfer/ntransfer in lua_Debug must have type
'int'. (Maximum stack size must fit in an 'int'.) Also, this commit
adds check that maximum stack size respects size_t for size in bytes.
2024-07-16 11:33:30 -03:00
Roberto Ierusalimschy
c1dc08e8e8 Length of external strings must fit in Lua integer
(As the length of any string in Lua.)
2024-06-24 12:03:59 -03:00
Roberto Ierusalimschy
0f7025dcae Details in the manual 2024-06-21 16:36:24 -03:00
Roberto Ierusalimschy
bdc85357aa Bug: Active-lines for stripped vararg functions
Lua seg. faults when asked to create the 'activelines' table for a
vararg function with no debug information.
2024-06-04 17:27:13 -03:00
Roberto Ierusalimschy
b291008cc2 Manual for 'string.format' lists what it accepts
Instead of listing what it does not accept, which is always relative.
2024-06-04 16:51:31 -03:00
Roberto Ierusalimschy
814213b65f utf8.offset returns also final position of character
'utf8.offset' returns two values: the initial and the final position
of the given character.
2024-05-27 11:29:39 -03:00
Roberto Ierusalimschy
cbdf4969ec Manual: errors in lua_toclose are not memory errors 2024-05-23 09:55:26 -03:00
Roberto Ierusalimschy
262dc5729a Details
Corrections in comments and manual. Added note in the manual about
local variables in the REPL.
2024-05-08 17:50:10 -03:00
Roberto Ierusalimschy
9d985db7bb New year (2024) 2024-05-02 12:03:30 -03:00
Roberto Ierusalimschy
86a8e74824 Details 2024-03-28 17:11:33 -03:00
Roberto Ierusalimschy
165389b27b New interface to function 'luaL_openselectedlibs'
Instead of preloading all non-loaded libraries, there is another
mask to select which libraries to preload.
2024-02-15 11:17:39 -03:00
Roberto Ierusalimschy
0c9bec0d38 Better handling of size limit when resizing a table
Avoid silent conversions from int to unsigned int when calling
'luaH_resize'; avoid silent conversions from lua_Integer to int in
'table.create'; MAXASIZE corrected for the new implementation of arrays;
'luaH_resize' checks explicitly whether new size respects MAXASIZE.
(Even constructors were bypassing that check.)
2024-02-07 13:39:54 -03:00
Roberto Ierusalimschy
c31d6774ac Details 2024-01-29 14:29:24 -03:00
Roberto Ierusalimschy
108e0bdc84 Merge branch 'master' into nextversion 2024-01-25 13:52:52 -03:00
Roberto Ierusalimschy
3e9dbe143d New function 'table.create'
Creates a table preallocating memory. (It just exports to Lua the API
function 'lua_createtable'.)
2024-01-18 15:16:26 -03:00
Roberto Ierusalimschy
4a8e480864 New mechanism to query GC parameters 2024-01-16 17:02:55 -03:00
Roberto Ierusalimschy
17e0c29d9b Clear interface between references and predefines
The reference system has a defined way to add initial values to the
table where it operates.
2024-01-15 11:31:49 -03:00
Roberto Ierusalimschy
7827c40c49 A few more tweaks in the garbage collector 2024-01-10 14:45:58 -03:00
Roberto Ierusalimschy
12b6f610b0 Several tweaks in the garbage collector
- back with step size in collectgarbage("step")
- adjustments in defaults for some GC parameters
- adjustments in 'luaO_codeparam'
2023-12-27 12:09:11 -03:00
Roberto Ierusalimschy
e2cc179454 New option "setparms" for 'collectgarbage'
The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
2023-12-22 14:48:07 -03:00
Roberto Ierusalimschy
666e95a66d Option 0 for step multiplier makes GC non-incremental 2023-12-20 11:06:27 -03:00
Roberto Ierusalimschy
4eda1acafa Cleaner protocol between 'lua_dump' and writer function
'lua_dump' signals to the writer function the end of a dump, so that
is has more freedom when using the stack.
2023-12-14 11:41:57 -03:00
Roberto Ierusalimschy
925fe8a0f2 First criteria for shifts minor<->major 2023-12-07 15:45:11 -03:00
Roberto Ierusalimschy
842a83f09c Panic functions should not raise errors
The standard panic function was using 'lua_tostring', which may raise
a memory-allocation error if error value is a number.
2023-11-24 16:08:55 -03:00
Roberto Ierusalimschy
011850a8f8 Details in the manual 2023-11-24 14:44:38 -03:00
Roberto Ierusalimschy
3b57e37e48 Fixed buffers save long strings as external. 2023-11-10 12:35:48 -03:00
Roberto Ierusalimschy
024f9064f1 External strings
Strings can use external buffers to store their contents.
2023-11-09 17:05:42 -03:00
Roberto Ierusalimschy
14e416355f Added suport for Fixed Buffers
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
2023-09-05 15:30:45 -03:00
Roberto Ierusalimschy
c815c2f0eb Merge branch 'master' into nextversion 2023-08-23 15:14:03 -03:00
Roberto Ierusalimschy
9363a8b990 Documentation for "LUA_NOENV"
Registry field "LUA_NOENV" (that signals to libraries that option -E
is on) now part of the "official" API of Lua stand-alone.
2023-08-23 13:50:38 -03:00
Roberto Ierusalimschy
ab6a949522 Merge branch 'master' into nextversion 2023-06-22 11:41:48 -03:00
Roberto Ierusalimschy
6443185167 "Emergency" new version 5.4.6
'lua_resetthread' is back to its original signature, to avoid
incompatibilities in the ABI between releases of the same version.
New function 'lua_closethread' added with the "correct" signature.
2023-05-02 16:41:43 -03:00
Roberto Ierusalimschy
e15f1f2bb7 Details
Typos in comments and details in the manual.
2023-04-18 09:44:10 -03:00
Roberto Ierusalimschy
b5c65705ca New year (2023)
Also, small tweak in makefile. (-Wsign-compare is already enabled by
-Wextra.)
2023-03-31 11:47:31 -03:00
Roberto Ierusalimschy
86e8039a72 Clock component removed from 'luaL_makeseed'
'clock' can be quite slow on some machines.
2023-03-23 16:01:16 -03:00
Roberto Ierusalimschy
5a04f1851e New function 'luaL_makeseed'
This function unifies code from 'lua_newstate', 'math.randomseed',
and 'table.sort' that tries to create a value with a minimum level
of randomness.
2023-03-20 16:13:17 -03:00
Roberto Ierusalimschy
b2f7b3b79f Control variables in for loops are read only 2022-12-21 12:04:59 -03:00
Roberto Ierusalimschy
540d805226 Towards Lua 5.5 2022-12-20 13:24:43 -03:00
Roberto Ierusalimschy
1e64c1391f Bug: stack overflow with nesting of coroutine.close 2022-10-25 16:44:06 -03:00
Roberto Ierusalimschy
c954db3924 Option '-l g=mod' added to the manual
Plus some other improvements in the manual.
2022-10-19 16:30:39 -03:00
Roberto Ierusalimschy
71bc69c2af Note in the manual about using '...' as an expression 2022-09-08 17:21:02 -03:00