aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* DetailsHEADmasterRoberto 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.
* Randomness added to table length computationRoberto Ierusalimschy2025-07-186-23/+48
| | | | | | | A bad actor could fill only a few entries in a table (power of twos in decreasing order, see tests) and produce a small table with a huge length. If your program builds a table with external data and iterates over its length, this behavior could be an issue.
* Correction in utf8.offsetRoberto Ierusalimschy2025-07-182-3/+13
| | | | Wrong utf-8 character may have no continuation bytes.
* Short strings can be external, tooRoberto Ierusalimschy2025-07-159-120/+168
| | | | | | | That complicates a little object equality (and therefore table access for long strings), but the old behavior was somewhat weird. (Short strings, a concept otherwise absent from the manual, could not be external.)
* lua.c doesn't use function pointers with LUA_READLINERoberto Ierusalimschy2025-07-091-22/+25
| | | | | Bugs in macOS prevent assigning 'add_history' to 'l_addhist' without a warning.
* New method to unload DLLsRoberto Ierusalimschy2025-07-093-36/+98
| | | | | | | | | | External strings created by DLLs may need the DLL code to be deallocated. This implies that a DLL can only be unloaded after all its strings were deallocated, which happen only after the run of all finalizers. To ensure that order, we create a 'library string' to represent each DLL and keep it locked. When this string is deallocated (after the deallocation of any string created by the DLL) it closes its corresponding DLL.
* lua option '--' may not be followed by scriptRoberto Ierusalimschy2025-07-082-5/+7
|
* Optional initialization for global declarationsRoberto Ierusalimschy2025-07-087-38/+96
|
* Correction in definition of CIST_FRESHRoberto Ierusalimschy2025-07-071-2/+2
| | | | | The cast must be made before the shift. If int has 16 bits, the shift would zero the value and the cast would cast 0 to 0.
* Details (comments)Roberto Ierusalimschy2025-07-075-8/+8
|
* Added missing casts from lua_Unsigned to size_tRoberto Ierusalimschy2025-07-012-3/+3
| | | | size_t can be smaller than lua_Usigned.
* LUAI_MAXSTACK defined privatelyRoberto Ierusalimschy2025-07-014-18/+17
| | | | | | LUAI_MAXSTACK is limited to INT_MAX/2, so can use INT_MAX/2 to define pseudo-indices (LUA_REGISTRYINDEX) in 'lua.h'. A change in the maximum stack size does not need to change the Lua-C ABI.
* Warning in loslib.c (signed-unsigned comparison)Roberto Ierusalimschy2025-06-271-2/+3
|
* Manual updated to version 5.5Roberto Ierusalimschy2025-06-272-9/+9
|
* Cast added to 'add_history'Roberto Ierusalimschy2025-06-261-2/+2
| | | | | MacOS defines 'add_history' with a "wrong" type (it returns 'int' instead of 'void').
* Application name for 'readline' is "lua", not "Lua"=listRoberto Ierusalimschy2025-06-231-1/+1
|
* Refactoring in the use of 'readline' by 'lua.c'Roberto Ierusalimschy2025-06-231-33/+38
| | | | | More common code for 'readline' loaded statically or dynamically (or not loaded).
* No need to limit variable declarations to 250Roberto Ierusalimschy2025-06-184-11/+38
| | | | Only local variables, which use registers, need this low limit.
* Check string indices when loading binary chunkRoberto Ierusalimschy2025-06-172-13/+11
| | | | | Lua is not religious about that, but it tries to avoid crashes when loading binary chunks.
* New metatable in an all-weak table can fool the GCRoberto Ierusalimschy2025-06-162-2/+15
| | | | | | All-weak tables are not being revisited after being visited during propagation; if it gets a new metatable after that, the new metatable may not be marked.
* 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
|