summaryrefslogtreecommitdiff
path: root/tex/context/base/l-lua.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/l-lua.lua')
-rw-r--r--tex/context/base/l-lua.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua
index 8ac351417..b62b7b070 100644
--- a/tex/context/base/l-lua.lua
+++ b/tex/context/base/l-lua.lua
@@ -13,6 +13,12 @@ local major, minor = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
_MAJORVERSION = tonumber(major) or 5
_MINORVERSION = tonumber(minor) or 1
+-- lpeg
+
+if not lpeg then
+ lpeg = require("lpeg")
+end
+
-- basics:
if loadstring then
@@ -105,3 +111,29 @@ if not package.loaders then -- brr, searchers is a special "loadlib function" us
package.loaders = package.searchers
end
+
+-- moved from util-deb to here:
+
+local print, select, tostring = print, select, tostring
+
+local inspectors = { }
+
+function setinspector(inspector) -- global function
+ inspectors[#inspectors+1] = inspector
+end
+
+function inspect(...) -- global function
+ for s=1,select("#",...) do
+ local value = select(s,...)
+ local done = false
+ for i=1,#inspectors do
+ done = inspectors[i](value)
+ if done then
+ break
+ end
+ end
+ if not done then
+ print(tostring(value))
+ end
+ end
+end