aboutsummaryrefslogtreecommitdiff
path: root/lapi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Cleaner handling of errors in '__close' metamethodsRoberto Ierusalimschy2020-12-281-1/+1
| | | | | Instead of protecting each individual metamethod call, protect the entire call to 'luaF_close'.
* Changes in the API of 'luaH_set' and related functionsRoberto Ierusalimschy2020-12-041-3/+1
| | | | | Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive the new value, instead of returning a slot where to put the value.
* Changed access to global table in the registryRoberto Ierusalimschy2020-11-261-8/+17
| | | | | The global table is always in the array part of the registry; we can use this fact to make its access slightly more efficient.
* 'lua_upvalueid' returns NULL on invalid upvalue indexRoberto Ierusalimschy2020-10-121-6/+13
|
* Avoid any code before locks in the APIRoberto Ierusalimschy2020-07-061-9/+17
| | | | | For consistency in the C API, avoid any initializations before callling lua_lock.
* Keep memory errors as memory errorsRoberto Ierusalimschy2020-07-061-1/+7
| | | | | | | 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.
* 'luaV_concat' can "concat" one single valueRoberto Ierusalimschy2020-07-031-5/+3
| | | | | Several of its callers needed that case and had to do the check themselves.
* Fixed detail in 'loadUpvalues'Roberto Ierusalimschy2020-06-301-0/+1
| | | | | | | | | In 'lundump.c', when loading the upvalues of a function, there can be a read error if the chunk is truncated. In that case, the creation of the error message can trigger an emergency collection while the prototype is still anchored. So, the prototype must be GC consistent before loading the upvales, which implies that it the 'name' fields must be filled with NULL before the reading.
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-11/+11
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
* Changed internal representation of booleansRoberto Ierusalimschy2020-01-061-1/+4
| | | | | | | Instead of an explicit value (field 'b'), true and false use different tag variants. This avoids reading an extra field and results in more direct code. (Most code that uses booleans needs to distinguish between true and false anyway.)
* Fixed bug in 'aux_rawset'Roberto Ierusalimschy2019-12-301-1/+1
| | | | | In 'aux_rawset', top must be decremented after the barrier, which refers to top-1. (Bug introduced in commit c646e57fd.)
* Joined common code in 'lua_rawset' and 'lua_rawsetp'Roberto Ierusalimschy2019-12-171-17/+14
|
* Small correction in assertionRoberto Ierusalimschy2019-12-131-1/+1
|
* Removed some wrong commentsRoberto Ierusalimschy2019-11-281-8/+6
| | | | | Both 'tonumber' and 'tointeger' cannot change the out parameter when the conversion fails.
* Undo change in the handling of 'L->top' (commit b80077b8f3)Roberto Ierusalimschy2019-08-291-2/+0
| | | | | | With MMBIN instructions, there are fewer opcodes that need to update 'L->top', so that change does not seem to pay for the increased complexity.
* Change in the handling of 'L->top' when calling metamethodsRoberto Ierusalimschy2019-07-261-0/+2
| | | | | | | 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'.)
* Calls 'luaF_close' in 'lua_settop' only when neededRoberto Ierusalimschy2019-07-171-5/+7
| | | | | In 'lua_settop', avoid calling 'luaF_close' when increasing the stack or when the function has no to-be-closed variables.
* Avoid setting the stack top below upvalues to be closedRoberto Ierusalimschy2019-07-161-7/+8
| | | | | | When leaving a scope, the new stack top should be set only after closing any upvalue, to avoid manipulating values in an "invalid" part of the stack.
* Small optimizations in range checksRoberto Ierusalimschy2019-03-271-4/+6
| | | | | | | | Checks of the form '1 <= x && x <= M' were rewritten in the form '(unsigned)x - 1 < (unsigned)M', which is usually more efficient. (Other similar checks have similar translations.) Although some compilers do these optimizations, that does not happen for all compilers or all cases.
* Changes in the warning systemRoberto Ierusalimschy2019-03-141-2/+2
| | | | | | | | - 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-9/+22
| | | | | | | | | | 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)
* After a "bad collections", avoid switching back back to generationalRoberto Ierusalimschy2019-01-301-4/+2
| | | | | | | After a major bad collection (one that collects too few objects), next collection will be major again. In that case, avoid switching back to generational mode (as it will have to switch again to incremental to do next major collection).
* No more LUA_ERRGCMM errorsRoberto Ierusalimschy2019-01-011-3/+1
| | | | | Errors in finalizers (__gc metamethods) are never propagated. Instead, they generate a warning.
* Added a warning system to LuaRoberto Ierusalimschy2018-12-281-0/+18
| | | | | The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program.
* Changes in the control of C-stack overflowRoberto Ierusalimschy2018-12-271-2/+2
| | | | | | | | | | * unification of the 'nny' and 'nCcalls' counters; * external C functions ('lua_CFunction') count more "slots" in the C stack (to allow for their possible use of buffers) * added a new test script specific for C-stack overflows. (Most of those tests were already present, but concentrating them in a single script easies the task of checking whether 'LUAI_MAXCCALLS' is adequate in a system.)
* A to-be-closed variable must have a closable value (or be nil)Roberto Ierusalimschy2018-11-291-1/+1
| | | | | | | 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.)
* Auxiliary buffer cannot close box with 'lua_remove'Roberto Ierusalimschy2018-11-261-2/+2
| | | | | | | To remove a to-be-closed variable from the stack in the C API a function must use 'lua_settop' or 'lua_pop'. Previous implementation of 'luaL_pushresult' was not closing the box. (This commit also added tests to check that box is being closed "as soon as possible".)
* 'lua_toclose' gets the index to be closed as an argumentRoberto Ierusalimschy2018-11-121-3/+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-1/+1
| | | | | | | 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-2/+13
|
* Details (comments)Roberto Ierusalimschy2018-09-111-1/+5
|
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-231-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* no need to check whether libraries and host use the same kernel;Roberto Ierusalimschy2018-06-181-5/+4
| | | | Lua should work correctly with several copies of the kernel
* new field 'nilvalue' in struct 'global_State' to avoid the use ofRoberto Ierusalimschy2018-06-151-13/+10
| | | | addresses of static variables
* removed unused macros 'isstackindex'/'api_checkstackindex' +Roberto Ierusalimschy2018-06-151-10/+2
| | | | macro 'api_checkvalidindex' (used only once) expanded and removed
* no more 'luaO_nilobject' to avoid comparison of global variable addressesRoberto Ierusalimschy2018-06-011-3/+5
| | | | (now uses static variables)
* no more nil-in-tableRoberto Ierusalimschy2018-04-041-22/+1
|
* 'lua_setiuservalue' removes value from the stack even in case of errorRoberto Ierusalimschy2018-02-271-2/+2
|
* metamethods for 'removekey'/'keyin'Roberto Ierusalimschy2018-02-271-11/+8
|
* better names for macros for tags and types.Roberto Ierusalimschy2018-02-261-16/+16
| | | | | rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag; tnov -> ttype
* first (parcial) implementation of 'keyin'/'removekey'Roberto Ierusalimschy2018-02-251-33/+59
| | | | (still no metamethods, no raw verssions)
* first version of empty entries in tablesRoberto Ierusalimschy2018-02-231-12/+18
| | | | (so that, in the future, tables can contain regular nil entries)
* userdata can have multiple user valuesRoberto Ierusalimschy2018-02-201-9/+26
|
* more generic way to handle 'gclist'Roberto Ierusalimschy2018-02-191-4/+4
|
* 'collectgarbage' returns old mode when changing modeRoberto Ierusalimschy2018-02-051-1/+5
|
* warnings in VS (implicit casts from ptrdiff_t to int)Roberto Ierusalimschy2018-01-291-2/+2
|
* janitor work on castsRoberto Ierusalimschy2018-01-281-4/+4
|
* error handler in protected calls must be a functionRoberto Ierusalimschy2018-01-101-1/+2
|
* more freedom in handling memory-allocation errors (not all allocationsRoberto Ierusalimschy2017-12-081-12/+2
| | | | | automatically raise an error), which allows fixing a bug when resizing a table.
* bug: 'lua_pushcclosure' should not call the GC when 'n' is zeroRoberto Ierusalimschy2017-12-061-3/+4
|