aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Keep memory errors as memory errorsRoberto Ierusalimschy2020-07-061-2/+4
| | | | | | | 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.
* Avoid calling 'fprintf' with NULLRoberto Ierusalimschy2020-06-091-1/+3
| | | | | | Avoid undefined behavior in calls like «fprintf("%s", NULL)». ('lua_writestringerror' is implemented as 'fprintf', and 'lua_tostring' can return NULL if object is not a string.)
* Details (more uniformity in error messages)Roberto Ierusalimschy2020-05-271-1/+1
|
* 'luaL_execresult' does not assume -1 status as errorRoberto Ierusalimschy2020-05-221-1/+1
| | | | | | | | | | | ISO C is silent about the return of 'system'. Windows sets 'errno' in case of errors. Linux has several different error cases, with different return values. ISO C allows 'system' to set 'errno' even if there are no errors. Here we assume that a status==0 is success (which is the case on several platforms), otherwise it is an error. If there is an error number, gives the error based on it. (The worst a spurious 'errno' can do is to generate a bad error message.) Otherwise uses the normal results.
* Details in commentsRoberto Ierusalimschy2020-05-071-1/+1
|
* DetailsRoberto Ierusalimschy2020-02-271-1/+1
| | | | | Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests.
* Default for warnings changed to "off"Roberto Ierusalimschy2019-08-201-1/+1
| | | | | Warnings are mostly a tool to help developers (e.g., by showing hidden error messages); regular users usually don't need to see them.
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-3/+3
| | | | | | | | 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'.
* Supressed errors in '__close' generate warningsRoberto Ierusalimschy2019-08-161-2/+2
|
* Added control messages to warningsRoberto Ierusalimschy2019-08-151-10/+24
| | | | | | | 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.
* Details (typos in comments)Roberto Ierusalimschy2019-07-051-1/+1
|
* Improvements in 'luaL_traceback'Roberto Ierusalimschy2019-05-281-24/+29
| | | | | | | | 'luaL_traceback' changed to use an aux buffer instead of concats. This should reduce the quantity of garbage it generates (in the form of intermediate strings) while producing a trackback. It also added information about the number of levels skipped when skipping levels in a trace.
* DetailsRoberto Ierusalimschy2019-05-131-3/+7
| | | | | | - 'luaL_setfuncs' avoids creating closures for placeholders. - Fixed some warnings about unused values in comma expressions. - Comments.
* New function 'luaL_addgsub'Roberto Ierusalimschy2019-04-241-7/+13
| | | | | | | | Added a new function 'luaL_addgsub', similar to 'luaL_gsub' but that adds its result directly to a preexisting buffer, avoiding the creation of one extra intermediate string. Also added two simple macros, 'luaL_bufflen' and 'luaL_buffaddr', to query the current length and the contents address of a buffer.
* Changes in the warning systemRoberto Ierusalimschy2019-03-141-19/+15
| | | | | | | | - 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.
* Added a warning system to LuaRoberto Ierusalimschy2018-12-281-1/+27
| | | | | The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program.
* Better error messages for some polymorphic functionsRoberto Ierusalimschy2018-12-101-3/+3
| | | | | | | | | New auxiliary functions/macros 'luaL_argexpected'/'luaL_typeerror' ease the creation of error messages such as bad argument #2 to 'setmetatable' (nil or table expected, got boolean) (The novelty being the "got boolean" part...)
* Auxiliary buffer cannot close box with 'lua_remove'Roberto Ierusalimschy2018-11-261-5/+7
| | | | | | | 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".)
* String buffer using to-be-closed variableRoberto Ierusalimschy2018-11-131-11/+15
| | | | | The string buffers in the C API now mark their boxes as to-be-closed variables, to release their buffers in case of errors.
* New implementation for 'luaL_addvalue'Roberto Ierusalimschy2018-11-091-22/+59
| | | | | | The function 'luaL_addvalue' (from the buffer system) was rewritten so that it does not change the position of the box (if present) in the stack.
* Removed resource-related "emergency collections"Roberto Ierusalimschy2018-10-311-43/+0
| | | | | New to-be-closed variables is a better way to ensure the proper release of resources.
* Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'Roberto Ierusalimschy2018-07-271-1/+45
| | | | | | | | These operations also can give errors for lack of resources, so they also will try "emergency collections" in case of resource errors. Because there are now two libraries with that kind of handling, 'resourcetryagain' was moved to the auxiliary library to be shared by the libraries.
* no need to check whether libraries and host use the same kernel;Roberto Ierusalimschy2018-06-181-6/+4
| | | | Lua should work correctly with several copies of the kernel
* removed compatibility code with older versionsRoberto Ierusalimschy2018-02-271-82/+1
|
* using new 'lua_newuserdatauv' instead of 'lua_newuserdata'Roberto Ierusalimschy2018-02-211-2/+2
|
* detailRoberto Ierusalimschy2018-01-291-2/+2
| | | | (uses a reserved-format name for an internal type in the registry)
* new constant 'LUA_GNAME' for the name of the global table "_G"Roberto Ierusalimschy2017-06-271-2/+2
|
* type 'L_Umaxalign' replaced by macro 'LUAI_MAXALIGN', which is also addedRoberto Ierusalimschy2017-04-241-3/+3
| | | | to the auxlib buffer
* Using LUAI_UAC* types more consistently on vararg callsRoberto Ierusalimschy2016-12-201-4/+4
|
* using constants for "_LOADED" and "PRELOAD"Roberto Ierusalimschy2016-12-041-12/+11
|
* 'luaL_tolstring' uses metatable's "__name" when availableRoberto Ierusalimschy2016-12-041-5/+14
|
* no more extra space in 'luaL_checkstack'. (It was already uselessRoberto Ierusalimschy2016-01-081-11/+10
| | | | | for the first call, and function works ok without that space anyway (just error message misses the 'msg' component)
* comments + small code changes around stack usage when 'luaL_checkstack'Roberto Ierusalimschy2015-12-141-5/+21
| | | | raises an error (and needs the stack to create the error message...)
* details (typos in comments)Roberto Ierusalimschy2015-11-191-3/+3
|
* allow NULL string when length is zero in 'lua_pushlstring' andRoberto Ierusalimschy2015-10-061-4/+6
| | | | 'luaL_addlstring'
* in 'luaL_traceback', print correct number of levels even whenRoberto Ierusalimschy2015-10-021-9/+11
| | | | initial level is not 1.
* better implementation for buffers (reallocated memory directlyRoberto Ierusalimschy2015-06-181-8/+52
| | | | with allocation function; generates much less garbage)
* detail ('luaL_getmetatable' does not return a boolean, but a tag)Roberto Ierusalimschy2015-02-031-2/+2
|
* traverse loaded modules (instead of globals) for a name for a function +Roberto Ierusalimschy2014-12-141-5/+13
| | | | removes prefix '_G.' from names (if present)
* in traceback names, give preference to 'name' over '_G.name'Roberto Ierusalimschy2014-12-131-3/+4
|
* give preference to global names in tracebacksRoberto Ierusalimschy2014-12-101-12/+10
|
* use 'namewhat' when building a tracebackRoberto Ierusalimschy2014-12-081-2/+2
|
* detail (buffer in 'LoadF' is related to files)Roberto Ierusalimschy2014-11-211-2/+2
|
* uses return value from luaL_getmetatableRoberto Ierusalimschy2014-11-121-3/+2
|
* added include for 'lprefix.h', for stuff that must be added beforeRoberto Ierusalimschy2014-11-021-4/+6
| | | | any other header file
* definitions for 'luai_writestring'/'luai_writeline'/'luai_writestringerror'Roberto Ierusalimschy2014-10-291-3/+3
| | | | | moved to 'lauxlib.h' (they do not need to be stable or configurable) + prefixes changed from 'luai_' to 'lua_' (they are not part of the core)
* `name' in comments changed to 'name'Roberto Ierusalimschy2014-10-251-5/+5
|
* added 'l_' prefix for names that can be redefined externallyRoberto Ierusalimschy2014-10-221-5/+5
|
* macros 'LUA_QL'/'LUA_QL' deprecatedRoberto Ierusalimschy2014-10-171-7/+7
|
* 'luaL_getmetafield' returns type of metafield (instead of a boolean)Roberto Ierusalimschy2014-09-221-16/+17
|