| Commit message (Collapse) | Author | Files | Lines |
|
A '__mode' metafield and an "n" key both can be external strings.
|
|
Semantic errors should refer the last used token, not the next one.
|
|
Initialization "global a = 10" raises an error if global 'a' is already
defined, that is, it has a non-nil value.
|
|
- 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'.
|
|
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.
|
|
In a global initialization, the variable does not pass through
'check_readonly', and therefore a VVARGIND is not normalized to a
VINDEXED.
|
|
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'.
|
|
Operation name can be diferent from metamethod name.
|
|
Also, makefile does not add compiling options (LOCAL) to linker
flags (MYLDFLAGS).
|
|
That makes easier to redefine luaL_newstate.
|
|
- Functions luaK_goiffalse, luaS_hash made private.
- Removed unused macro log2maxs.
|
|
For external strings and for vararg tables.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
To allow some optimizations on its use.
|
|
Not yet optimized nor documented.
|
|
- 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, 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.
|
|
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.
|
|
The reasoning in commit 519c57d5 is wrong: A sequence of nils generates
several fields with just one OP_LOADNIL.
|
|
LUAI_FUNC is now defined in llimits.h.
|
|
Allows non-Posix systems to use off_t and related functions for
file offsets.
|
|
|
|
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.
|
|
|
|
Not all errors in a message handler generate a LUA_ERRERR.
|
|
The call to 'luaH_getn' can change the "field" 'lenhint' of a table.
|
|
Opcodes OP_SHLI-OP_SHRI and the cases for opcodes OP_SHL-OP_SHR were
out of order.
|
|
Its check should use the type of the object, not its tag. (Change only
relevant in test mode.)
|
|
|
|
They are basic for anything that handles the representation of
floating numbers.
|
|
|
|
Just add -DLUA_USER_H='"ltests.h"' when compiling it.
|
|
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.)
|
|
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.
|
|
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.
|
|
Wrong utf-8 character may have no continuation bytes.
|
|
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.)
|
|
Bugs in macOS prevent assigning 'add_history' to 'l_addhist' without
a warning.
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
size_t can be smaller than lua_Usigned.
|
|
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.
|
|
|
|
|