Skip to content

Commit 277f022

Browse files
committed
add debug helper
1 parent 77207de commit 277f022

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nattlua/other/lua_compat.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ do -- these are just helpers for print debugging
5252
io.write("\n")
5353
end
5454

55+
function debug.print_line(level)
56+
local info = debug.getinfo(level or 3)
57+
58+
if not info then return "**unknown line**" end
59+
60+
if info.source:sub(1, 1) == "@" then
61+
io.write(info.source:sub(2) .. ":" .. info.currentline, "\n")
62+
return
63+
end
64+
65+
io.write(info.source .. ":" .. info.currentline, "\n")
66+
end
67+
5568
do
5669
local old = print
5770
local context = require("nattlua.analyzer.context")

0 commit comments

Comments
 (0)