Commit Graph

265 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
46beca5bed Better error messages for some polymorphic functions
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...)
2018-12-10 13:46:03 -02:00
Roberto Ierusalimschy
f99509581e Removed extra information from RCS keyword strings
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
2018-08-23 14:26:12 -03:00
Roberto Ierusalimschy
b2d4d06428 avoid possible overflows when checking sizes in 'string.unpack' 2018-05-25 10:39:32 -03:00
Roberto Ierusalimschy
b03dddf9e4 removed coercion string->number in bitwise operations
(can be done with a Lua module)
2018-02-21 14:48:31 -03:00
Roberto Ierusalimschy
c67603fafb using new 'lua_newuserdatauv' instead of 'lua_newuserdata' 2018-02-21 10:48:44 -03:00
Roberto Ierusalimschy
599f1742c6 detail (typo in comments) 2017-11-23 17:29:04 -02:00
Roberto Ierusalimschy
e4e5aa85a2 detail ('signal' -> 'sign' in comments) 2017-11-16 11:19:06 -02:00
Roberto Ierusalimschy
26679ea35b new function 'luaV_flttointeger' to convert floats to integers (without
string coercions) + string operands to bitwise operations handled
by string metamethods
2017-11-08 12:50:23 -02:00
Roberto Ierusalimschy
4dff277255 coercion string->number in arithmetic operations moved to string
library
2017-07-07 13:34:32 -03:00
Roberto Ierusalimschy
01c96ad12e handling of inf, -inf, and NaN by string.format'%q' 2017-05-19 13:29:40 -03:00
Roberto Ierusalimschy
1a1b2f3d7f added 'return' to calls to 'luaL_error' (to signal to the compiler
that the function cannot continue past that call)
2017-03-14 09:40:44 -03:00
Roberto Ierusalimschy
2a235312f0 detail (removing spaces at end of lines) 2016-12-22 11:08:50 -02:00
Roberto Ierusalimschy
9903dd52a3 Using LUAI_UAC* types more consistently on vararg calls 2016-12-20 16:37:00 -02:00
Roberto Ierusalimschy
09c9fa36ea small corrections for C++ compliance 2016-06-27 10:15:08 -03:00
Roberto Ierusalimschy
707b0ba6e2 'string.format("%q")' writes 'math.mininteger' in hexa, to ensure
it is read back as an integer
2016-05-20 11:13:21 -03:00
Roberto Ierusalimschy
4d5ab9baa6 'string.pack("cn")' does not accept strings longer than 'n' 2016-05-18 15:19:51 -03:00
Roberto Ierusalimschy
fbd8614bdb comment (FALLTHROUGH) 2016-05-13 16:09:46 -03:00
Roberto Ierusalimschy
22093f9c6e 'string.format("%q", number)' ensures a dot as decimal point 2016-05-02 10:58:01 -03:00
Roberto Ierusalimschy
57cdb60429 no more time limits to pattern matching (at least for now) 2016-04-22 13:36:30 -03:00
Roberto Ierusalimschy
89c09c8e40 match time limit defined by variable 'string.pattlimit' 2016-04-19 09:34:08 -03:00
Roberto Ierusalimschy
e8e39a277f 'string.format"%q"' now works for all basic types (nil, boolean,
numbers, and strings)
2016-04-08 18:15:02 -03:00
Roberto Ierusalimschy
fff7d42a69 LUA_PACKPADBYTE -> LUAL_PACKPADBYTE (it is an internal library
name, not something to be usually configured)
2016-04-07 12:40:07 -03:00
Roberto Ierusalimschy
783aa8a9da new way to avoid infinite loops in empty matches: "Python rule"
("Empty matches for the pattern are replaced only when not
adjacent to a previous match")
2016-03-31 16:07:42 -03:00
Roberto Ierusalimschy
e747491b96 comments 2016-03-23 15:08:26 -03:00
Roberto Ierusalimschy
acff3ad88d bug: 'gmatch' iterator fails when called from a coroutine different
from the one that created it
2016-03-23 14:12:17 -03:00
Roberto Ierusalimschy
c3e9b14d24 '\0' is a control character, no need to check it explicitly 2016-02-25 16:42:55 -03:00
Roberto Ierusalimschy
c25d59a6bd format "%s" in 'string.format' accepts embedded zeros when it
has no modifiers
2015-11-25 14:28:17 -02:00
Roberto Ierusalimschy
3feb702df8 ensure argument to 'string.format("%s")' does not contain zeros 2015-11-23 09:31:21 -02:00
Roberto Ierusalimschy
789e423b32 corrected comparisons of signed (int) with unsigned (size_t) 2015-10-29 13:11:41 -02:00
Roberto Ierusalimschy
cc3a42b190 option 'c' in 'string.pack' accepts any string size (truncating
if larger and padding if smaller)
2015-10-28 15:56:51 -02:00
Roberto Ierusalimschy
880df57e52 detail (removed unreacheable 'break') 2015-10-08 12:53:05 -03:00
Roberto Ierusalimschy
10fffcd80a 'gmatch' keeps its state in a userdata (keeping the same 'MatchState'
across calls)
2015-09-28 15:05:01 -03:00
Roberto Ierusalimschy
8264dbc2bb implemented counter to abort non-linear behavior in pattern matching 2015-09-26 15:45:03 -03:00
Roberto Ierusalimschy
5273477cb9 in 'lua_number2strx', use the call to 'l_sprintf' to add exponent
to result directly
2015-07-20 13:30:22 -03:00
Roberto Ierusalimschy
5aabb7a891 buffer size changed from size_t to int (it is always small) +
comments + assert that printf result fits in given buffer
2015-06-24 15:25:10 -03:00
Roberto Ierusalimschy
19eb6ae580 using 'snprintf' in C99 (both for documentation of buffer sizes
and some complains from tools)
2015-06-18 11:26:05 -03:00
Roberto Ierusalimschy
99391e24ea new configuration macro 'l_mathlim' (simplifies some dependencies
on float type)
2015-05-20 14:39:23 -03:00
Roberto Ierusalimschy
48d0674c2e more consistent use of locale radix character across Lua 2015-04-03 15:41:57 -03:00
Roberto Ierusalimschy
e723c75c02 details (avoid 'lint' warnings) 2015-03-28 16:14:47 -03:00
Roberto Ierusalimschy
2a57d2346e detail 2015-02-09 16:05:46 -02:00
Roberto Ierusalimschy
5e8c162b6c detail 2015-02-05 15:50:24 -02:00
Roberto Ierusalimschy
b7dfd18612 make buffer for format specification a little larger (length modifier
can be larger than 2, e.g. "I64")
2015-02-04 10:54:31 -02:00
Roberto Ierusalimschy
8efcd411fe own implementation for 'string.format("%a")' for C89 platforms 2015-02-04 10:52:57 -02:00
Roberto Ierusalimschy
3509914916 BUG (when compiled with long double): buffer overflow when formatting
string.format("%.99f", 1e4930)
2015-01-13 15:18:25 -02:00
Roberto Ierusalimschy
57e91b4159 correct computation for limit in 'getnum' 2014-12-11 12:03:07 -02:00
Roberto Ierusalimschy
ef7d29c666 better limits for 'sting.rep' and 'string.packsize' 2014-12-11 11:40:40 -02:00
Roberto Ierusalimschy
5c519a69d3 new function 'string.packsize' 2014-12-10 09:36:03 -02:00
Roberto Ierusalimschy
32a1f54b9a no more default size for option 'c' in pack/unpack 2014-12-04 14:25:40 -02:00
Roberto Ierusalimschy
b401d37188 detail (to avoid a "to avoid warnings" return) 2014-11-11 17:40:20 -02:00
Roberto Ierusalimschy
74e10b9c3b details (error messages) 2014-11-08 16:12:53 -02:00