aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* '__pairs' can also return a to-be-closed objectHEADmasterRoberto I11 days3-9/+15
|
* External strings are as good as internal onesRoberto I11 days4-6/+28
| | | | A '__mode' metafield and an "n" key both can be external strings.
* Correction in line info for semantic errorsRoberto I11 days2-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.
* 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
|