summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/mlib-scn.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/mlib-scn.lmt')
-rw-r--r--tex/context/base/mkxl/mlib-scn.lmt34
1 files changed, 33 insertions, 1 deletions
diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt
index 6032fd861..56fdce0fb 100644
--- a/tex/context/base/mkxl/mlib-scn.lmt
+++ b/tex/context/base/mkxl/mlib-scn.lmt
@@ -550,7 +550,6 @@ local function getparameterdefault()
-- return injectnumeric(0)
return 0
else
- print("LAST",last)
-- return get(last)
return last
end
@@ -765,6 +764,30 @@ function metapost.setparameterset(namespace,t)
namespaces[namespace] = t
end
+function metapost.getparameterpreset(namespace,t)
+ return namespace and presets[namespace] or presets
+end
+
+local function setluaparameter()
+ local namespace = scanstring()
+ local name = scanstring()
+ local value = scanstring()
+ local code = load("return " .. value)
+ if type(code) == "function" then
+ local result = code()
+ if result then
+ local data = namespace and namespaces[namespace] or namespaces
+ data[name] = result
+ else
+ report("no result from lua code: %s",value)
+ end
+ else
+ report("invalid lua code: %s",value)
+ end
+end
+
+registerdirect("setluaparameter", setluaparameter)
+
-- This is an experiment for Alan and me.
do
@@ -890,6 +913,15 @@ do
end
end
+ function metapost.setrecord(name,data)
+ if type(data) == "table" then
+ local index = names[name]
+ if index then
+ records[index] = data
+ end
+ end
+ end
+
function metapost.runinternal(action,index,kind,name)
if action == 0 then
-- allocate