comparison tools/linedebug.lua @ 11200:bf8f2da84007

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 05 Nov 2020 22:31:25 +0100
parents 5850d24a4ad3
children
comparison
equal deleted inserted replaced
11199:6c7c50a4de32 11200:bf8f2da84007
1 local data = {}
2 local getinfo = debug.getinfo;
3 local function linehook(ev, li)
4 local S = getinfo(2, "S");
5 if S and S.source and S.source:match"^@" then
6 local file = S.source:sub(2);
7 local lines = data[file];
8 if not lines then
9 lines = {};
10 data[file] = lines;
11 for line in io.lines(file) do
12 lines[#lines+1] = line;
13 end
14 end
15 io.stderr:write(ev, " ", file, " ", li, " ", lines[li], "\n");
16 end
17 end
18 debug.sethook(linehook, "l");