summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/util-deb.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/util-deb.lmt')
-rw-r--r--tex/context/base/mkxl/util-deb.lmt22
1 files changed, 21 insertions, 1 deletions
diff --git a/tex/context/base/mkxl/util-deb.lmt b/tex/context/base/mkxl/util-deb.lmt
index 0021b93b9..71a43ea17 100644
--- a/tex/context/base/mkxl/util-deb.lmt
+++ b/tex/context/base/mkxl/util-deb.lmt
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['util-deb'] = {
-- bound to a variable, like node.new, node.copy etc (contrary to for instance
-- node.has_attribute which is bound to a has_attribute local variable in mkiv)
-local type, next, tostring, tonumber = type, next, tostring, tonumber
+local type, next, tostring, tonumber, xpcall, print = type, next, tostring, tonumber, xpcall, print
local format, find, sub, gsub = string.format, string.find, string.sub, string.gsub
local insert, remove, sort = table.insert, table.remove, table.sort
local setmetatableindex = table.setmetatableindex
@@ -369,3 +369,23 @@ debugger.showtraceback = showtraceback
-- debug.showtraceback = showtraceback
-- showtraceback()
+
+if luac then
+
+ local show, dump = luac.print, string.dump
+
+ function luac.inspect(v)
+ if type(v) == "function" then
+ local ok, str = xpcall(dump,function() end,v)
+ if ok then
+ v = str
+ end
+ end
+ if type(v) == "string" then
+ show(v,true)
+ else
+ print(v)
+ end
+ end
+
+end