aboutsummaryrefslogtreecommitdiff
path: root/manual (unfollow)
Commit message (Collapse)AuthorFilesLines
12 days'__pairs' can also return a to-be-closed objectHEADmasterRoberto I1-2/+2
12 daysExternal strings are as good as internal onesRoberto I4-6/+28
A '__mode' metafield and an "n" key both can be external strings.
12 daysCorrection in line info for semantic errorsRoberto I2-22/+43
Semantic errors should refer the last used token, not the next one.
2025-11-08Global initialization checks name conflictRoberto I13-9/+87
Initialization "global a = 10" raises an error if global 'a' is already defined, that is, it has a non-nil value.
2025-10-31DetailsRoberto I3-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'.
2025-10-30Vertical bar removed from syntax of vararg tableRoberto I5-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.
2025-10-30Case VVARGIND added to luaK_storevarRoberto Ierusalimschy2-0/+16
In a global initialization, the variable does not pass through 'check_readonly', and therefore a VVARGIND is not normalized to a VINDEXED.
2025-10-29Fixed initialization of global variablesRoberto I3-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'.
2025-10-18Small change in 'trymt'Roberto I1-4/+11
Operation name can be diferent from metamethod name.
2025-10-18Added "attribute internal" to __MACH__ platformsRoberto I2-10/+10
Also, makefile does not add compiling options (LOCAL) to linker flags (MYLDFLAGS).
2025-10-17Standard allocator function added to the APIRoberto I3-15/+28
That makes easier to redefine luaL_newstate.
2025-10-14DetailsRoberto I5-11/+2
- Functions luaK_goiffalse, luaS_hash made private. - Removed unused macro log2maxs.
2025-10-12Two new memory testsRoberto I1-9/+33
For external strings and for vararg tables.
2025-10-10Change in dumping of NULL stringsRoberto I2-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.
2025-10-10Initialization of too many locals break assertionRoberto I2-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.
2025-09-24Optimization for vararg tablesRoberto I13-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.
2025-09-18Small tweaks in makefileRoberto I1-3/+2
2025-09-17Varag parameter is a new kind of variableRoberto I7-16/+65
To allow some optimizations on its use.
2025-09-16Vararg tableRoberto I9-31/+80
Not yet optimized nor documented.
2025-09-05DetailsRoberto I6-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).
2025-09-05In C++, 'throw' must go to the correct handler.Roberto I1-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.
2025-08-30Allows LUA_32BITS to be defined externallyRoberto Ierusalimschy1-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.
2025-08-27Added limit to number of elements in a constructorRoberto I2-4/+19
The reasoning in commit 519c57d5 is wrong: A sequence of nils generates several fields with just one OP_LOADNIL.
2025-08-27'ltests.h' should not use LUAI_FUNCRoberto I1-6/+6
LUAI_FUNC is now defined in llimits.h.
2025-08-26New compile option LUA_USE_OFF_TRoberto Ierusalimschy1-1/+1
Allows non-Posix systems to use off_t and related functions for file offsets.
2025-08-26update in 'onelua.c'Roberto Ierusalimschy1-5/+15
2025-08-21Some definitions moved from luaconf.h to llimits.hRoberto Ierusalimschy2-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.
2025-08-20Removed code for compatibility with version 5.3Roberto I7-61/+3
2025-08-20Better documentation for LUA_ERRERRRoberto I2-4/+13
Not all errors in a message handler generate a LUA_ERRERR.
2025-08-20Added lock/unlock to API function 'lua_rawlen'Roberto I1-1/+7
The call to 'luaH_getn' can change the "field" 'lenhint' of a table.
2025-08-20Keep the order left-right in shiftsRoberto I5-12/+12
Opcodes OP_SHLI-OP_SHRI and the cases for opcodes OP_SHL-OP_SHR were out of order.
2025-08-20Detail in 'obj2gco'Roberto I1-2/+2
Its check should use the type of the object, not its tag. (Change only relevant in test mode.)
2025-08-20Small cleaning servicesRoberto I3-30/+46
2025-08-09Functions 'frexp'-'ldexp' back to the math libraryRoberto I3-17/+46
They are basic for anything that handles the representation of floating numbers.
2025-08-09DetailsRoberto I5-28/+51
2025-07-29'onelua' can use the test libraryRoberto Ierusalimschy4-13/+34
Just add -DLUA_USER_H='"ltests.h"' when compiling it.
2025-07-29Added some casts for 32-bit machinesRoberto Ierusalimschy3-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.)
2025-07-23Fix in string.repRoberto Ierusalimschy1-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.
2025-07-18Randomness added to table length computationRoberto Ierusalimschy6-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.
2025-07-18Correction in utf8.offsetRoberto Ierusalimschy2-3/+13
Wrong utf-8 character may have no continuation bytes.
2025-07-15Short strings can be external, tooRoberto Ierusalimschy9-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.)
2025-07-09lua.c doesn't use function pointers with LUA_READLINERoberto Ierusalimschy1-22/+25
Bugs in macOS prevent assigning 'add_history' to 'l_addhist' without a warning.
2025-07-09New method to unload DLLsRoberto Ierusalimschy3-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.
2025-07-08lua option '--' may not be followed by scriptRoberto Ierusalimschy2-5/+7
2025-07-08Optional initialization for global declarationsRoberto Ierusalimschy7-38/+96
2025-07-07Correction in definition of CIST_FRESHRoberto Ierusalimschy1-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.
2025-07-07Details (comments)Roberto Ierusalimschy5-8/+8
2025-07-01Added missing casts from lua_Unsigned to size_tRoberto Ierusalimschy2-3/+3
size_t can be smaller than lua_Usigned.
2025-07-01LUAI_MAXSTACK defined privatelyRoberto Ierusalimschy4-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.
2025-06-27Warning in loslib.c (signed-unsigned comparison)Roberto Ierusalimschy1-2/+3