aboutsummaryrefslogtreecommitdiff
path: root/liolib.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Renaming two new functionsRoberto Ierusalimschy2025-01-271-1/+1
| | | | | 'lua_numbertostrbuff' -> 'lua_numbertocstring' 'lua_pushextlstring' -> 'lua_pushexternalstring'
* New function 'lua_numbertostrbuff'Roberto Ierusalimschy2024-10-231-13/+9
| | | | | It converts a Lua number to a string in a buffer, without creating a new Lua string.
* Added gcc option '-Wconversion'Roberto Ierusalimschy2024-07-271-4/+4
| | | | | No warnings for standard numerical types. Still pending alternative numerical types.
* llimits.h being used by all Lua codeRoberto Ierusalimschy2024-06-201-2/+1
| | | | | | The definitions in llimits.h are useful not only for the core. That header only defines types and '#define's, so libs and core still do not share any real code/data.
* More disciplined use of 'errno'Roberto Ierusalimschy2024-06-121-6/+19
| | | | | | | | | Set errno to zero before calling any function where we may use its errno, and check errno for zero before using it (as functions may not set it even in error). The code assumes that no function will put garbage on errno (although ISO C allows that): If any function during an operation set errno, and the operation result in an error, assume that errno has something to say.
* Manual: errors in lua_toclose are not memory errorsRoberto Ierusalimschy2024-05-231-1/+1
|
* Broadening the use of branch hintsRoberto Ierusalimschy2021-02-241-8/+9
| | | | | | More uses of macros 'likely'/'unlikely' (renamed to 'l_likely'/'l_unlikely'), both in range (extended to the libraries) and in scope (extended to hooks, stack growth).
* n Windows, 'popen' accepts "[rw][bt]?" as valid modesRoberto Ierusalimschy2020-12-031-6/+12
| | | | Added the modifiers 'b' and 't' to valid modes for 'popen' in Windows.
* Fixed bug: invalid mode can crash 'io.popen'Roberto Ierusalimschy2020-07-151-0/+7
|
* 'luaL_execresult' does not assume -1 status as errorRoberto Ierusalimschy2020-05-221-0/+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.
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-2/+2
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-5/+5
| | | | | | | | 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'.
* Correction in the documentation of 'io.lines'Roberto Ierusalimschy2019-07-311-1/+1
| | | | | | The loop does not end on end of file, but when the iterator function fails to read a value. (In particular, the format "a" never fails, so a loop with 'io.lines(fname, "a")' never ends.)
* Details (typos in comments)Roberto Ierusalimschy2019-07-051-1/+1
|
* Methods separated from metamethods in 'io'Roberto Ierusalimschy2019-07-011-10/+20
| | | | | | | In the 'io' library, changed the use of the metatable also as its own "method table", so that metamethods cannot be accessed as if they were methods. (For instance, 'io.stdin.__gc' does not result in the finalizer metamethod anymore.)
* DetailsRoberto Ierusalimschy2019-05-281-5/+5
| | | | | | | - new error message for "attempt to assign to const variable" - note in the manual about compatibility options - comments - small changes in 'read_line' and 'pushstr'
* DetailsRoberto Ierusalimschy2019-05-131-1/+1
| | | | | | - 'luaL_setfuncs' avoids creating closures for placeholders. - Fixed some warnings about unused values in comma expressions. - Comments.
* To-be-closed variable in 'for' loop separated from the stateRoberto Ierusalimschy2018-11-071-2/+4
| | | | | | | | | The variable to be closed in a generic 'for' loop now is the 4th value produced in the loop initialization, instead of being the loop state (the 2nd value produced). That allows a loop to use a state with a '__toclose' metamethod but do not close it. (As an example, 'f:lines()' might use the file 'f' as a state for the loop, but it should not close the file when the loop ends.)
* Removed resource-related "emergency collections"Roberto Ierusalimschy2018-10-311-19/+2
| | | | | New to-be-closed variables is a better way to ensure the proper release of resources.
* State in generic 'for' acts as a to-be-closed variableRoberto Ierusalimschy2018-10-311-6/+29
| | | | | | | | | | | The implicit variable 'state' in a generic 'for' is marked as a to-be-closed variable, so that the state will be closed as soon as the loop ends, no matter how. Taking advantage of this new facility, the call 'io.lines(filename)' now returns the open file as a second result. Therefore, an iteraction like 'for l in io.lines(name)...' will close the file even when the loop ends with a break or an error.
* Added a '__close' metamethod to file handlesRoberto Ierusalimschy2018-10-231-0/+1
|
* Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'Roberto Ierusalimschy2018-07-271-48/+6
| | | | | | | | 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.
* File operations try an "emergency collection" when failingRoberto Ierusalimschy2018-07-251-4/+64
| | | | | | | | | If a file operation fails do to lack of resources (too many open files or not enough memory), it does a full garbage collection and tries the operation again. Lack of resources are "too many open files" (process wise and system wise) and "not enough memory". The code is full of '#if's because error codes are not part of the standard ISO C.
* back to one format per argumentRoberto Ierusalimschy2018-03-021-30/+26
|
* using new 'lua_newuserdatauv' instead of 'lua_newuserdata'Roberto Ierusalimschy2018-02-211-2/+2
|
* 'io.read' accepts multiple formats in a single string argumentRoberto Ierusalimschy2017-11-161-27/+31
|
* detail ('signal' -> 'sign' in comments)Roberto Ierusalimschy2017-11-161-3/+3
|
* error when calling close method without arguments (e.g.,Roberto Ierusalimschy2017-02-091-4/+9
| | | | |io.stdin.close()|)
* Using LUAI_UAC* types more consistently on vararg callsRoberto Ierusalimschy2016-12-201-3/+5
|
* detail (macro 'l_checkmode' reimplemented as function)Roberto Ierusalimschy2016-09-011-5/+6
|
* 'io.read("n")' accepts both a dot and the locale point as itsRoberto Ierusalimschy2016-05-021-8/+11
| | | | | radix character + 'MAXRN' -> 'L_MAXLENNUM' + small detail in 'test2'
* easy the way to accept other modifiers for 'mode' in 'io.open'Roberto Ierusalimschy2015-11-231-7/+13
|
* bug: 'io.lines' does not check maximum number of optionsRoberto Ierusalimschy2015-07-151-1/+8
|
* detail (comment)Roberto Ierusalimschy2015-07-071-2/+2
|
* detailRoberto Ierusalimschy2015-06-211-2/+2
|
* more consistent use of locale radix character across LuaRoberto Ierusalimschy2015-04-031-9/+4
|
* detail (use 'lua_pushliteral' to push an empty string)Roberto Ierusalimschy2015-03-061-2/+2
|
* clearer(?) code (also avoids a warning about 'c' being usedRoberto Ierusalimschy2015-01-021-5/+3
| | | | without initialization)
* avoid memory errors while a file is locked (when reading a line)Roberto Ierusalimschy2014-11-211-7/+16
|
* comments (references to "ANSI C" changed to "ISO C", which is theRoberto Ierusalimschy2014-11-021-3/+3
| | | | international name
* added include for 'lprefix.h', for stuff that must be added beforeRoberto Ierusalimschy2014-11-021-12/+4
| | | | any other header file
* LUA_WIN -> LUA_USE_WINDOWSRoberto Ierusalimschy2014-10-311-3/+3
|
* `name' in comments changed to 'name'Roberto Ierusalimschy2014-10-251-2/+2
|
* detail (using 'sizeof' instead of 'strlen' for length of a constantv5.3-betaRoberto Ierusalimschy2014-10-221-2/+3
| | | | string)
* added 'l_' prefix for names that can be redefined externallyRoberto Ierusalimschy2014-10-221-4/+4
|
* 'lua_stringtonum' -> 'lua_stringtonumber'Roberto Ierusalimschy2014-10-171-4/+4
|
* macros 'LUA_QL'/'LUA_QL' deprecatedRoberto Ierusalimschy2014-10-171-3/+3
|
* 'lua_strtonum' -> 'lua_stringtonum'Roberto Ierusalimschy2014-10-151-3/+3
|
* details (comments)Roberto Ierusalimschy2014-10-031-2/+2
|
* detailRoberto Ierusalimschy2014-10-011-2/+2
|