| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
'luaD_throw' may call 'luaE_resetthread', which returns an error code
but clears 'L->status'; so, 'luaD_throw' should set that status again.
|
| |
|
|
|
|
|
| |
The callstatus flag CIST_CLSRET is used in all tests for the
presence of variables to be closed in C functions.
|
| |
|
|
|
|
|
| |
Instead of preloading all non-loaded libraries, there is another
mask to select which libraries to preload.
|
|
|
|
|
| |
The reference system has a defined way to add initial values to the
table where it operates.
|
| |
|
| |
|
|
|
|
|
| |
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
|
|\ |
|
| |
| |
| |
| |
| | |
Test files are more polite regarding the use of globals when locals
would do, and when globals are necessary deleting them after use.
|
|/
|
|
| |
Makes it easier to start Lua with only some standard libraries.
|
|
|
|
| |
As the GC is not reentrant, finalizers should not be able to invoke it.
|
|
|
|
|
|
| |
The existence of 'lua_closeslot' is no reason for lua_pop not to close
to-be-closed variables too. It is too error-prone for lua_pop not to
close tbc variables being popped from the stack.
|
|
|
|
|
|
| |
Closing a to-be-closed variable with 'lua_settop' is too restrictive,
as it erases all slots above the variable. Moreover, it adds side
effects to 'lua_settop', which should be a fairly basic function.
|
|
|
|
|
|
|
| |
Allow memory errors to be raised through the API (throwing the
error with the memory error message); error in external allocations
raises a memory error; memory errors in coroutines are re-raised
as memory errors.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The macro 'luaL_pushfail' documents all places in the standard libraries
that return nil to signal some kind of failure. It is defined as
'lua_pushnil'. The manual also got a notation (@fail) to document those
returns. The tests were changed to be agnostic regarding whether 'fail'
is 'nil' or 'false'.
|
|
|
|
|
|
|
| |
Added the concept of control messages to the warning system, plus the
implementation of the controls "@on"/"@off" to turn warnings on/off.
Moreover, the warning system in the test library adds some other
controls to ease the test of warnings.
|
|
|
|
|
|
|
|
|
| |
When initializing a to-be-closed variable, check whether it has a
'__close' metamethod (or is a false value) and raise an error if
if it hasn't. This produces more accurate error messages. (The
check before closing still need to be done: in the C API, the value
is not constant; and the object may lose its '__close' metamethod
during the block.)
|
|
|
|
|
|
|
| |
Attributes changed to posfixed ('x <const>', instead of '<const> x'),
and "toclose" renamed to "close". Posfixed attributes seem to make it
clearer that it applies to only one variable when there are multiple
variables.
|
|
|
|
|
|
|
| |
Instead of updating 'L->top' in every place that may call a
metamethod, the metamethod functions themselves (luaT_trybinTM and
luaT_callorderTM) correct the top. (When calling metamethods from
the C API, however, the callers must preserve 'L->top'.)
|
|
|
|
|
|
|
|
|
|
|
| |
This commit brings a new implementation for HARDMEMTESTS, which forces
an emergency GC whenever possible. It also fixes some issues detected
with this option:
- A small bug in lvm.c: a closure could be collected by an emergency
GC while being initialized.
- Some tests: a memory address can be immediatly reused after a GC;
for instance, two consecutive '{}' expressions can return exactly the
same address, if the first one is not anchored.
|
|
|
|
|
| |
Added tests where the table being accessed is also the index or
value in the operation.
|
|
|
|
|
|
|
| |
The flag for to-be-closed variables was changed from '*toclose'
to '<toclose>'. Several people found confusing the old syntax and
the new one has a clear terminator, making it more flexible for
future changes.
|
|
|
|
|
|
|
|
| |
- The warning functions get an extra parameter that tells whether
message is to be continued (instead of using end-of-lines as a signal).
- The user data for the warning function is a regular value, instead
of a writable slot inside the Lua state.
|
|
|
|
|
|
|
|
|
|
| |
Several small improvements (code style, warnings, comments, more tests),
in particular:
- 'lua_topointer' extended to handle strings
- raises an error in 'string.format("%10q")' ('%q' with modifiers)
- in the manual for 'string.format', the term "option" replaced by
"conversion specifier" (the term used by the C standard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To-be-closed variables must contain objects with '__toclose'
metamethods (or nil). Functions were removed for several reasons:
* Functions interact badly with sandboxes. If a sandbox raises
an error to interrupt a script, a to-be-closed function still
can hijack control and continue running arbitrary sandboxed code.
* Functions interact badly with coroutines. If a coroutine yields
and is never resumed again, its to-be-closed functions will never
run. To-be-closed objects, on the other hand, will still be closed,
provided they have appropriate finalizers.
* If you really need a function, it is easy to create a dummy
object to run that function in its '__toclose' metamethod.
This comit also adds closing of variables in case of panic.
|
|
|
|
|
| |
Errors in finalizers (__gc metamethods) are never propagated.
Instead, they generate a warning.
|
|
|
|
|
| |
The warning system is just a way for Lua to emit warnings, messages
to the programmer that do not interfere with the running program.
|
|
|
|
|
|
|
| |
It is an error for a to-be-closed variable to have a non-closable
non-nil value when it is being closed. This situation does not seem to
be useful and often hints to an error. (Particularly in the C API, it is
easy to change a to-be-closed index by mistake.)
|
|
|
|
|
|
| |
Sometimes it is useful to mark to-be-closed an index that is not
at the top of the stack (e.g., if the value to be closed came from
a function call returning multiple values).
|
|
|
|
|
|
|
| |
The new syntax is <local *toclose x = f()>. The mark '*' allows other
attributes to be added later without the need of new keywords; it
also allows better error messages. The API function was also renamed
('lua_tobeclosed' -> 'lua_toclose').
|
| |
|
|
|
|
|
| |
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all test files; only the file name are kept.
|
|
|
|
|
|
|
| |
Still missing:
- handling of memory errors when creating upvalue (must run closing
method all the same)
- interaction with coroutines
|
|
|
|
|
|
|
| |
From the point of view of 'git', all names are relative to the root
directory of the project. So, file names in '$Id:' also should be
relative to that directory: the proper name for test file 'all.lua'
is 'testes/all.lua'.
|
|
|