summaryrefslogtreecommitdiff
path: root/scripts/context/lua/mtxrun.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/context/lua/mtxrun.lua')
-rw-r--r--scripts/context/lua/mtxrun.lua29
1 files changed, 23 insertions, 6 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 3e6d9e303..c5232a6d3 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -4016,14 +4016,31 @@ function tables.definetable(target) -- defines undefined tables
return concat(t,"\n")
end
-function tables.accesstable(target)
- local t = _G
+function tables.accesstable(target,root)
+ local t = root or _G
for name in gmatch(target,"([^%.]+)") do
t = t[name]
+ if not t then
+ return
+ end
end
return t
end
+function tables.migratetable(target,v,root)
+ local t = root or _G
+ local names = string.split(target,".")
+ for i=1,#names-1 do
+ local name = names[i]
+ t[name] = t[name] or { }
+ t = t[name]
+ if not t then
+ return
+ end
+ end
+ t[names[#names]] = v
+end
+
function tables.removevalue(t,value) -- todo: n
if value then
for i=1,#t do
@@ -4158,8 +4175,8 @@ local storage = utilities.storage
function storage.mark(t)
if not t then
- texio.write_nl("fatal error: storage '%s' cannot be marked",t)
- os.exit()
+ texio.write_nl("fatal error: storage cannot be marked")
+ return -- os.exit()
end
local m = getmetatable(t)
if not m then
@@ -4188,8 +4205,8 @@ end
function storage.checked(t)
if not t then
- texio.write_nl("fatal error: storage '%s' has not been allocated",t)
- os.exit()
+ texio.write_nl("fatal error: storage has not been allocated")
+ return -- os.exit()
end
return t
end