27edcc9a92
Fix possible error in rare cases in LuaTable:
Enyby
2019-12-29 16:46:58 +02:00
d6737c0bb3
Improve work with weak keys. `` for _, m in ipairs({'', 'k', 'kv', 'v'}) do print('test', m) a = {}; setmetatable(a, {__mode = m}); a[1], a[2], a[3] = {}, {}, {}; for k, v in pairs(a) do print(k, v) end end print('ok') ``
Enyby
2019-12-16 15:31:13 +02:00
d201bc3012
Fix work with weak tables. `` a = {}; setmetatable(a, {__mode = 'vk'}); a[1], a[2], a[3] = {}, {}, {}; for k, v in pairs(a) do print(k, v) end print('ok') ``
Enyby
2019-12-15 20:39:26 +02:00
ca64666242
Fix metamethods for compare with numbers. ``` t = {} t.__lt = function (a,b,c) collectgarbage() assert(c == nil) if type(a) == 'table' then a = a.x end if type(b) == 'table' then b = b.x end return a<b, "dummy" end
Enyby
2019-11-11 02:47:19 +02:00
725cf89b6f
Fix metamethods for compare with string.
Enyby
2019-11-11 02:29:20 +02:00
0f0ec4bf7b
Add check for too complex patterns. `` -- bug since 2.5 (C-stack overflow) do local function f (size) local s = string.rep("a", size) local p = string.rep(".?", size) return pcall(string.match, s, p) end local r, m = f(80) assert(r and #m == 80) r, m = f(200000) assert(not r and string.find(m, "too complex"), tostring(r)..", "..tostring(m)) end ``
Enyby
2019-11-09 23:25:07 +02:00
8c42c4712b
Fix empty matches in patterns. ``` do -- new (5.3.3) semantics for empty matches assert(string.gsub("a b cd", " *", "-") == "-a-b-c-d-")
Enyby
2019-11-09 23:20:06 +02:00
6bc8fd6b1b
Fix numeric for add order.
Enyby
2019-11-09 23:12:31 +02:00
bf663878cb
Add support for metatags to table lib methods: sort, insert, remove, unpack. ``` do -- testing table library with metamethods local function test (proxy, t) for i = 1, 10 do table.insert(proxy, 1, i) end assert(#proxy == 10 and #t == 10, tostring(#proxy)..'; '..tostring(#t)) for i = 1, 10 do assert(t[i] == 11 - i) end table.sort(proxy) for i = 1, 10 do assert(t[i] == i and proxy[i] == i, i..': '..tostring(proxy[i])..'; '..tostring(t[i])) end assert(table.concat(proxy, ",") == "1,2,3,4,5,6,7,8,9,10") for i = 1, 8 do assert(table.remove(proxy, 1) == i) end assert(#proxy == 2 and #t == 2) local a, b, c = table.unpack(proxy) assert(a == 9 and b == 10 and c == nil) end
Enyby
2019-11-04 07:57:49 +02:00
9a20aa8077
Check pos bounds for table.insert.
Enyby
2019-11-03 15:55:32 +02:00
99f21b6277
Speed up table.sort.
Enyby
2019-11-03 14:03:53 +02:00
53bd4bf71f
Fix compiler Bug{ what = [[label between local definitions can mix-up their initializations]], report = [[Karel Tuma, 2016/03/01]], since = [[5.2]], fix = nil, example = [[ do local k = 0 local x ::foo:: local y -- should be reset to nil after goto, but it is not assert(not y) y = true k = k + 1 if k < 2 then goto foo end end ]], patch = [[ --- lparser.c 2015/11/02 16:09:30 2.149 +++ lparser.c 2016/03/03 12:03:37 @@ -1226,7 +1226,7 @@ checkrepeated(fs, ll, label); /* check for repeated labels */ checknext(ls, TK_DBCOLON); /* skip double colon */ /* create new entry for this label */ - l = newlabelentry(ls, ll, label, line, fs->pc); + l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); skipnoopstat(ls); /* skip other no-op statements */ if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ /* assume that locals are already out of scope */ ]] }
Enyby
2019-11-02 17:02:21 +02:00
22e7a8c620
Fix lexer bugs. Already handled by case above.
Enyby
2019-10-21 10:16:43 +03:00
c8461b8128
Fix pattern classes in string lib. ``` local ref = { } for cl in string.gmatch('acdglpsuwxACDGLPSUWX', '.') do local list = '' for i = 0, 255 do if string.match(string.char(i), '%'..cl) then list = list..i..',' end end if ref[cl] then assert(ref[cl] == list, cl..':\n'..list..'\n'..ref[cl]) else print(cl..' = "'..list..'",') end end
Enyby
2019-10-21 08:43:53 +03:00
a50deaa75c
Fix raise error from io.lines and file:lines.
Enyby
2019-10-07 14:52:12 +03:00
f9f78b81da
Allow read zero bytes in io lib methods.
Enyby
2019-10-07 14:26:21 +03:00
984fa30bf6
Fix read all stdin in JSE.
Enyby
2019-10-07 00:25:07 +03:00
65beda4c2b
Fix read all at EOF.
Enyby
2019-10-07 00:23:34 +03:00
934a8fc57b
Fix io.read(0) on EOF.
Enyby
2019-10-06 23:49:04 +03:00
832ec739ea
Close not closed file on GC. #55 Relevant only for J2SE, not for J2ME.
Enyby
2019-10-06 23:35:45 +03:00
8345bee6b4
Fix io.lines and file:lines do not honor additional params. #52 Fix io.lines do not close file on EOF. #53 Improve error message for io.lines and file:lines on closed file.
Enyby
2019-10-06 19:09:01 +03:00
83f2e1d96a
Fix io.read and file:read do not support '*L' format. #54
Enyby
2019-10-06 18:53:15 +03:00
6ba28727d2
move doubleToRawLongBits (not present on JME) to JSE class
asie
2019-08-11 12:48:34 +02:00
0707e71c6c
Support __pairs and __ipairs
gamax92
2019-08-11 12:14:21 +02:00
43f937470f
Fix classes based on LibFunction giving "value" for their error message.
gamax92
2019-08-11 12:11:40 +02:00
5d3f2eb72c
LuaClosure: Add the colon after line numbers to error messages
gamax92
2019-08-11 12:10:11 +02:00
244eb4b1a1
StringLib: Support seperators in string.rep
gamax92
2019-08-11 12:07:47 +02:00
626664a0fe
BaseLib: fix handling of __tostring
gamax92
2019-08-11 12:05:48 +02:00
2bccb4670e
LuaValue: add 0x to tojstring() to match Lua
gamax92
2019-08-11 12:01:51 +02:00
89acb5bcb5
LuaString: port strx2number for accurate double scanning, handle plus signs when converting strings to numbers
gamax92
2019-08-11 11:59:49 +02:00
c69585332b
LexState: rename TK_EOS and <eos> to TK_EOF and <eof> to match Lua
gamax92
2019-08-11 11:55:42 +02:00