aboutsummaryrefslogtreecommitdiff
path: root/testes/api.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fixing 'lua_status' in panic.Roberto Ierusalimschy2025-01-161-0/+19
| | | | | 'luaD_throw' may call 'luaE_resetthread', which returns an error code but clears 'L->status'; so, 'luaD_throw' should set that status again.
* Better support in 'ltests' for tracing the GCRoberto Ierusalimschy2024-10-211-1/+1
|
* Using CIST_CLSRET instead of trick with 'nresults'Roberto Ierusalimschy2024-07-191-0/+17
| | | | | The callstatus flag CIST_CLSRET is used in all tests for the presence of variables to be closed in C functions.
* API asserts for illegal pops of to-be-closed variablesRoberto Ierusalimschy2024-03-111-1/+2
|
* New interface to function 'luaL_openselectedlibs'Roberto Ierusalimschy2024-02-151-5/+5
| | | | | Instead of preloading all non-loaded libraries, there is another mask to select which libraries to preload.
* Clear interface between references and predefinesRoberto Ierusalimschy2024-01-151-10/+27
| | | | | The reference system has a defined way to add initial values to the table where it operates.
* Fixed buffers reuse absolute line informationRoberto Ierusalimschy2023-12-271-0/+14
|
* Fixed buffers save long strings as external.Roberto Ierusalimschy2023-11-101-5/+9
|
* Added suport for Fixed BuffersRoberto Ierusalimschy2023-09-051-5/+46
| | | | | A fixed buffer keeps a binary chunk "forever", so that the program does not need to copy some of its parts when loading it.
* Merge branch 'master' into nextversionRoberto Ierusalimschy2022-12-281-51/+61
|\
| * Avoid excessive name pollution in test filesRoberto Ierusalimschy2022-12-281-51/+61
| | | | | | | | | | Test files are more polite regarding the use of globals when locals would do, and when globals are necessary deleting them after use.
* | New function 'luaL_openselectedlibs'Roberto Ierusalimschy2022-12-071-6/+8
|/ | | | Makes it easier to start Lua with only some standard libraries.
* Bug: GC is not reentrantRoberto Ierusalimschy2021-12-131-3/+2
| | | | As the GC is not reentrant, finalizers should not be able to invoke it.
* lua_settop/lua_pop closes to-be-closed variablesRoberto Ierusalimschy2021-03-091-1/+25
| | | | | | 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.
* New API function 'lua_closeslot'Roberto Ierusalimschy2021-01-111-12/+17
| | | | | | 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.
* Keep memory errors as memory errorsRoberto Ierusalimschy2020-07-061-16/+59
| | | | | | | 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.
* Comments (mosty typos)Roberto Ierusalimschy2019-12-301-2/+2
|
* Joined common code in 'lua_rawset' and 'lua_rawsetp'Roberto Ierusalimschy2019-12-171-2/+4
|
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-1/+1
| | | | | | | | 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 control messages to warningsRoberto Ierusalimschy2019-08-151-0/+2
| | | | | | | 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.
* To-be-closed variables must be closed on initializationRoberto Ierusalimschy2019-07-311-1/+10
| | | | | | | | | 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.)
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-301-1/+1
| | | | | | | 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.
* Change in the handling of 'L->top' when calling metamethodsRoberto Ierusalimschy2019-07-261-0/+17
| | | | | | | 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'.)
* Reviving HARDMEMTESTSRoberto Ierusalimschy2019-07-181-2/+5
| | | | | | | | | | | 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.
* A few more tests for table access in the APIRoberto Ierusalimschy2019-06-251-1/+47
| | | | | Added tests where the table being accessed is also the index or value in the operation.
* Flag for to-be-closed variables changed to '<toclose>'Roberto Ierusalimschy2019-05-091-1/+2
| | | | | | | 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.
* Changes in the warning systemRoberto Ierusalimschy2019-03-141-7/+5
| | | | | | | | - 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.
* DetailsRoberto Ierusalimschy2019-03-131-7/+14
| | | | | | | | | | 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)
* No more to-be-closed functionsRoberto Ierusalimschy2019-01-041-1/+18
| | | | | | | | | | | | | | | | | | | 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.
* No more LUA_ERRGCMM errorsRoberto Ierusalimschy2019-01-011-19/+9
| | | | | Errors in finalizers (__gc metamethods) are never propagated. Instead, they generate a warning.
* Added a warning system to LuaRoberto Ierusalimschy2018-12-281-0/+14
| | | | | The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program.
* A to-be-closed variable must have a closable value (or be nil)Roberto Ierusalimschy2018-11-291-7/+14
| | | | | | | 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.)
* 'lua_toclose' gets the index to be closed as an argumentRoberto Ierusalimschy2018-11-121-8/+10
| | | | | | 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).
* New syntax for to-be-closed variablesRoberto Ierusalimschy2018-11-071-6/+6
| | | | | | | 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').
* To-be-closed variables in the C APIRoberto Ierusalimschy2018-10-251-0/+71
|
* Removed extra information from RCS keyword strings in testsRoberto Ierusalimschy2018-10-221-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all test files; only the file name are kept.
* First "complete" implementation of to-be-closed variablesRoberto Ierusalimschy2018-10-171-1/+13
| | | | | | | Still missing: - handling of memory errors when creating upvalue (must run closing method all the same) - interaction with coroutines
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | 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'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+1264