aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* DetailsRoberto I2025-12-302-5/+4
| | | | | Some comments still talked about bit 'isrealasize', which has been removed.
* BUG: Arithmetic overflow in 'collectgarbage"step"'Roberto I2025-12-271-2/+7
| | | | | | | The computation of a new debt could overflow when we give a too large step to 'collectgarbage"step"' and the current debt was already negative. This is only an issue if your platform cares for it or if you compile Lua with an option like '-fsanitize=undefined'.
* DetailsRoberto I2025-12-233-3/+3
| | | | | typo in comment + formatting + logical 'and' was written as a bitwise operation (makes code more fragile)
* GC checks stack space before running finalizerv5.5.0Roberto I2025-12-133-3/+16
| | | | | | If the stack does not have some minimum available space, the GC defers calling a finalizer until the next cycle. That avoids errors while running a finalizer that the programmer cannot control.
* 'luaL_newstate' starts state with warnings onRoberto I2025-12-132-2/+3
| | | | It is easier to forget to turn them on then to turn them off.
* Format adjust in the manualRoberto I2025-12-101-19/+19
| | | | | Lists in inline code don't get a space after commas. (That keeps the code more compact and avoids line breaks in the middle of the code.)
* DetailsRoberto I2025-12-082-8/+8
| | | | | - Avoid fixing name "_ENV" in the code - Small improvements in the manual
* Wrong assert in 'luaK_indexed'Roberto I2025-12-081-3/+5
|
* In luaB_close, running coroutines do not go to defaultrcRoberto I2025-12-011-4/+6
| | | | This should had been corrected in commit fd897027f1.
* Functions with vararg tables don't need hidden args.Roberto I2025-11-289-43/+70
| | | | | Vararg functions with vararg tables don't use the arguments hidden in the stack; therfore, it doesn't need to build/keep them.
* New conceptual model for varargRoberto I2025-11-2611-69/+154
| | | | | | Conceptually, all functions get their vararg arguments in a vararg table. The storing of vararg arguments in the stack is always treated as an optimization.
* DetailsRoberto I2025-11-243-16/+23
| | | | Comments, capitalization in the manual, globals in test 'heady.lua'
* '__pairs' can also return a to-be-closed objectRoberto I2025-11-113-9/+15
|
* External strings are as good as internal onesRoberto I2025-11-114-6/+28
| | | | A '__mode' metafield and an "n" key both can be external strings.
* Correction in line info for semantic errorsRoberto I2025-11-112-22/+43
| | | | Semantic errors should refer the last used token, not the next one.
* Global initialization checks name conflictRoberto I2025-11-0813-9/+87
| | | | | Initialization "global a = 10" raises an error if global 'a' is already defined, that is, it has a non-nil value.
* DetailsRoberto I2025-10-313-8/+10
| | | | | | - New macro l_strcoll to ease changing 'strcoll' to something else. - MAXINDEXRK==1 in 'ltests.h' is enough to run test 'code.lua'. - Removed unused '#include' in 'lutf8lib.c'.
* Vertical bar removed from syntax of vararg tableRoberto I2025-10-305-22/+20
| | | | | | The syntax 'function foo (a, b, ...arg)' is already used by JavaScript for this same semantics, so it seems natural to use the same notation in Lua.
* Case VVARGIND added to luaK_storevarRoberto Ierusalimschy2025-10-302-0/+16
| | | | | | In a global initialization, the variable does not pass through 'check_readonly', and therefore a VVARGIND is not normalized to a VINDEXED.
* Fixed initialization of global variablesRoberto I2025-10-293-13/+52
| | | | | | | | When calling 'luaK_storevar', the 'expdesc' for the variable must be created before the one for the expression, to satisfy the assumptions for register allocation. So, in a statement like 'global a = exp', where 'a' is actually '_ENV.a', this variable must be handled before the initializing expression 'exp'.
* Small change in 'trymt'Roberto I2025-10-181-4/+11
| | | | Operation name can be diferent from metamethod name.
* Added "attribute internal" to __MACH__ platformsRoberto I2025-10-182-10/+10
| | | | | Also, makefile does not add compiling options (LOCAL) to linker flags (MYLDFLAGS).
* Standard allocator function added to the APIRoberto I2025-10-173-15/+28
| | | | That makes easier to redefine luaL_newstate.
* DetailsRoberto I2025-10-145-11/+2
| | | | | - Functions luaK_goiffalse, luaS_hash made private. - Removed unused macro log2maxs.
* Two new memory testsRoberto I2025-10-121-9/+33
| | | | For external strings and for vararg tables.
* Change in dumping of NULL stringsRoberto I2025-10-102-15/+19
| | | | | | | | When dumping a string, adding 2 to its size may overflow a size_t for external strings, which may not have a header. (Adding 1 is Ok, because all strings end with a '\0' not included in their size.) The new method for saving NULL strings code them as a repeated string, using the reserved index 0.
* Initialization of too many locals break assertionRoberto I2025-10-102-7/+13
| | | | | | The check for limit of local variables is made after generating code to initialize them. If there are too many local variables not initialized, the coding of instruction OP_LOADNIL could overflow an argument.
* Optimization for vararg tablesRoberto I2025-09-2413-63/+186
| | | | | | | A vararg table can be virtual. If the vararg table is used only as a base in indexing expressions, the code does not need to create an actual table for it. Instead, it compiles the indexing expressions into direct accesses to the internal vararg data.
* Small tweaks in makefileRoberto I2025-09-181-3/+2
|
* Varag parameter is a new kind of variableRoberto I2025-09-177-16/+65
| | | | To allow some optimizations on its use.
* Vararg tableRoberto I2025-09-169-31/+80
| | | | Not yet optimized nor documented.
* DetailsRoberto I2025-09-056-5/+11
| | | | | | | - LUAMOD_API defined as 'extern "C"' in C++. - "ANSI C" is in fact "ISO C" (comments) - Removed option -std from makefile in testes/libs. (Easier to change to C++ for tests).
* In C++, 'throw' must go to the correct handler.Roberto I2025-09-051-17/+25
| | | | | | | | In C, we may have several "setjmp" nested, and the "longjmp" will go to the one given by the corresponding "jmp_buf". In C++, a "throw" will always go to the inner "catch". So, the "catch" must check whether it is the recipient of the "throw" and, if not, rethrow the exception to the outer level.
* Allows LUA_32BITS to be defined externallyRoberto Ierusalimschy2025-08-301-2/+2
| | | | | | An external definition for LUA_32BITS can change the API, but libraries check number-format compatibility when loading. So, any incompatible modules will report a clear error.
* Added limit to number of elements in a constructorRoberto I2025-08-272-4/+19
| | | | | The reasoning in commit 519c57d5 is wrong: A sequence of nils generates several fields with just one OP_LOADNIL.
* 'ltests.h' should not use LUAI_FUNCRoberto I2025-08-271-6/+6
| | | | LUAI_FUNC is now defined in llimits.h.
* New compile option LUA_USE_OFF_TRoberto Ierusalimschy2025-08-261-1/+1
| | | | | Allows non-Posix systems to use off_t and related functions for file offsets.
* update in 'onelua.c'Roberto Ierusalimschy2025-08-261-5/+15
|
* Some definitions moved from luaconf.h to llimits.hRoberto Ierusalimschy2025-08-212-50/+50
| | | | | | These definitions were in luaconf.h only because the standard libraries need them. Now that llimits.h is included by the libraries, it offers a more private place for these definitions.
* Removed code for compatibility with version 5.3Roberto I2025-08-207-61/+3
|
* Better documentation for LUA_ERRERRRoberto I2025-08-202-4/+13
| | | | Not all errors in a message handler generate a LUA_ERRERR.
* Added lock/unlock to API function 'lua_rawlen'Roberto I2025-08-201-1/+7
| | | | The call to 'luaH_getn' can change the "field" 'lenhint' of a table.
* Keep the order left-right in shiftsRoberto I2025-08-205-12/+12
| | | | | Opcodes OP_SHLI-OP_SHRI and the cases for opcodes OP_SHL-OP_SHR were out of order.
* Detail in 'obj2gco'Roberto I2025-08-201-2/+2
| | | | | Its check should use the type of the object, not its tag. (Change only relevant in test mode.)
* Small cleaning servicesRoberto I2025-08-203-30/+46
|
* Functions 'frexp'-'ldexp' back to the math libraryRoberto I2025-08-093-17/+46
| | | | | They are basic for anything that handles the representation of floating numbers.
* DetailsRoberto I2025-08-095-28/+51
|
* 'onelua' can use the test libraryRoberto Ierusalimschy2025-07-294-13/+34
| | | | Just add -DLUA_USER_H='"ltests.h"' when compiling it.
* Added some casts for 32-bit machinesRoberto Ierusalimschy2025-07-293-4/+4
| | | | | | When both 'int' and 'l_obj' have 32 bits, an unsigned int needs a cast to be assigned to 'l_obj'. (As long as 'l_obj' can count the total memory used by the system, these casts should be safe.)
* Fix in string.repRoberto Ierusalimschy2025-07-231-8/+12
| | | | | | | | | | | | The cast of n (number of repetitions) to size_t may truncate its value, causing a buffer overflow later. Better to check the buffer size using lua_Integer, as all string lengths must fit in a lua_Integer and n already is a lua_Integer. If everything fits in MAX_SIZE, then we can safely convert n to size_t and compute the buffer size as a size_t. As a corner case, n can be larger than size_t if the strings being repeated have length zero, but in this case it will be multiplied by zero, so an overflow in the cast is irrelevant.