summaryrefslogtreecommitdiff
path: root/lstrlib.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Avoid using large buffers in 'string.format'Roberto Ierusalimschy2019-04-121-12/+28
| | | | | | | The result of "string.format("%.99f", -1e308) is 410 characters long, but all other formats have much smaller limits (at most 99 plus a fex extras). This commit avoids 'string.format' asking for a buffer ~400 chars large when ~100 will do.
* Small optimizations in 'string.gsub'Roberto Ierusalimschy2019-04-111-46/+84
| | | | | | | | | | | Avoid creating extra strings when possible: - avoid creating new resulting string when subject was not modified (instead, return the subject itself); - avoid creating strings representing the captured substrings when handling replacements like '%1' (instead, add the substring directly to the buffer).
* New conversion specifier '%p' for 'string.format'Roberto Ierusalimschy2019-03-131-0/+5
| | | | | The call 'string.format("%p", val)' gives a Lua equivalent to the C API function 'lua_topointer'.
* DetailsRoberto Ierusalimschy2019-03-131-2/+4
| | | | | | | | | | 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)
* Optional 'init' argument to 'string.gmatch'Roberto Ierusalimschy2019-01-081-24/+52
| | | | | | | | | The function 'string.gmatch' now has an optional 'init' argument, similar to 'string.find' and 'string.match'. Moreover, there was some reorganization in the manipulation of indices in the string library. This commit also includes small janitorial work in the manual and in comments in the interpreter loop.
* DetailRoberto Ierusalimschy2018-12-271-2/+1
| | | | Slightly better error message for invalid conversions in 'string.format'.
* Better error messages for some polymorphic functionsRoberto Ierusalimschy2018-12-101-2/+2
| | | | | | | | | 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...)
* 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.
* avoid possible overflows when checking sizes in 'string.unpack'Roberto Ierusalimschy2018-05-251-11/+8
|
* removed coercion string->number in bitwise operationsRoberto Ierusalimschy2018-02-211-59/+1
| | | | (can be done with a Lua module)
* using new 'lua_newuserdatauv' instead of 'lua_newuserdata'Roberto Ierusalimschy2018-02-211-2/+2
|
* detail (typo in comments)Roberto Ierusalimschy2017-11-231-2/+2
|
* detail ('signal' -> 'sign' in comments)Roberto Ierusalimschy2017-11-161-2/+2
|
* new function 'luaV_flttointeger' to convert floats to integers (withoutRoberto Ierusalimschy2017-11-081-9/+71
| | | | | string coercions) + string operands to bitwise operations handled by string metamethods
* coercion string->number in arithmetic operations moved to stringRoberto Ierusalimschy2017-07-071-2/+86
| | | | library
* handling of inf, -inf, and NaN by string.format'%q'Roberto Ierusalimschy2017-05-191-14/+28
|
* added 'return' to calls to 'luaL_error' (to signal to the compilerRoberto Ierusalimschy2017-03-141-4/+4
| | | | that the function cannot continue past that call)
* detail (removing spaces at end of lines)Roberto Ierusalimschy2016-12-221-2/+2
|
* Using LUAI_UAC* types more consistently on vararg callsRoberto Ierusalimschy2016-12-201-7/+9
|
* small corrections for C++ complianceRoberto Ierusalimschy2016-06-271-2/+2
|
* 'string.format("%q")' writes 'math.mininteger' in hexa, to ensureRoberto Ierusalimschy2016-05-201-14/+19
| | | | it is read back as an integer
* 'string.pack("cn")' does not accept strings longer than 'n'Roberto Ierusalimschy2016-05-181-8/+6
|
* comment (FALLTHROUGH)Roberto Ierusalimschy2016-05-131-3/+3
|
* 'string.format("%q", number)' ensures a dot as decimal pointRoberto Ierusalimschy2016-05-021-7/+21
|
* no more time limits to pattern matching (at least for now)Roberto Ierusalimschy2016-04-221-38/+1
|
* match time limit defined by variable 'string.pattlimit'Roberto Ierusalimschy2016-04-191-16/+36
|
* 'string.format"%q"' now works for all basic types (nil, boolean,Roberto Ierusalimschy2016-04-081-6/+36
| | | | numbers, and strings)
* LUA_PACKPADBYTE -> LUAL_PACKPADBYTE (it is an internal libraryRoberto Ierusalimschy2016-04-071-6/+6
| | | | name, not something to be usually configured)
* new way to avoid infinite loops in empty matches: "Python rule"Roberto Ierusalimschy2016-03-311-8/+8
| | | | | ("Empty matches for the pattern are replaced only when not adjacent to a previous match")
* commentsRoberto Ierusalimschy2016-03-231-12/+12
|
* bug: 'gmatch' iterator fails when called from a coroutine differentRoberto Ierusalimschy2016-03-231-5/+4
| | | | from the one that created it
* '\0' is a control character, no need to check it explicitlyRoberto Ierusalimschy2016-02-251-2/+2
|
* format "%s" in 'string.format' accepts embedded zeros when itv5.3.2Roberto Ierusalimschy2015-11-251-9/+12
| | | | has no modifiers
* ensure argument to 'string.format("%s")' does not contain zerosRoberto Ierusalimschy2015-11-231-1/+2
|
* corrected comparisons of signed (int) with unsigned (size_t)Roberto Ierusalimschy2015-10-291-3/+3
|
* option 'c' in 'string.pack' accepts any string size (truncatingRoberto Ierusalimschy2015-10-281-3/+8
| | | | if larger and padding if smaller)
* detail (removed unreacheable 'break')Roberto Ierusalimschy2015-10-081-2/+2
|
* 'gmatch' keeps its state in a userdata (keeping the same 'MatchState'Roberto Ierusalimschy2015-09-281-20/+26
| | | | across calls)
* implemented counter to abort non-linear behavior in pattern matchingRoberto Ierusalimschy2015-09-261-26/+46
|
* in 'lua_number2strx', use the call to 'l_sprintf' to add exponentRoberto Ierusalimschy2015-07-201-4/+3
| | | | to result directly
* buffer size changed from size_t to int (it is always small) +Roberto Ierusalimschy2015-06-241-7/+10
| | | | comments + assert that printf result fits in given buffer
* using 'snprintf' in C99 (both for documentation of buffer sizesRoberto Ierusalimschy2015-06-181-16/+18
| | | | and some complains from tools)
* new configuration macro 'l_mathlim' (simplifies some dependenciesRoberto Ierusalimschy2015-05-201-10/+7
| | | | on float type)
* more consistent use of locale radix character across LuaRoberto Ierusalimschy2015-04-031-2/+3
|
* details (avoid 'lint' warnings)Roberto Ierusalimschy2015-03-281-12/+12
|
* detailRoberto Ierusalimschy2015-02-091-2/+2
|
* detailRoberto Ierusalimschy2015-02-051-2/+2
|
* make buffer for format specification a little larger (length modifierRoberto Ierusalimschy2015-02-041-3/+2
| | | | can be larger than 2, e.g. "I64")
* own implementation for 'string.format("%a")' for C89 platformsRoberto Ierusalimschy2015-02-041-3/+84
|
* BUG (when compiled with long double): buffer overflow when formattingRoberto Ierusalimschy2015-01-131-5/+11
| | | | string.format("%.99f", 1e4930)