diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-07-23 19:46:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-07-23 19:46:04 +0200 |
commit | c73351bc5e590d5a7ebd2b0f13f895a447d25794 (patch) | |
tree | 4e2028329e2c0b63a7818463918397de328d6432 /tex/context/base/mkxl/mlib-scn.lmt | |
parent | ed85eb918354b77672bbe347c2afcfe2e0b6b7fb (diff) | |
download | context-c73351bc5e590d5a7ebd2b0f13f895a447d25794.tar.gz |
2021-07-23 18:53:00
Diffstat (limited to 'tex/context/base/mkxl/mlib-scn.lmt')
-rw-r--r-- | tex/context/base/mkxl/mlib-scn.lmt | 34 |
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 |