diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-07-17 18:25:12 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-07-17 18:25:12 +0200 |
commit | 57dbee16f3a8e09e688f792c6e36a53de798e6cb (patch) | |
tree | b33d22d8d6abc98577d8d242e2c5bbacdd4bb234 /tex/context/base/mkiv/mlib-lua.lua | |
parent | a8f63ee70a866cce43ee4b1bb5ba95ef8044243f (diff) | |
download | context-57dbee16f3a8e09e688f792c6e36a53de798e6cb.tar.gz |
2018-07-17 17:32:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-lua.lua')
-rw-r--r-- | tex/context/base/mkiv/mlib-lua.lua | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 1c7b069cd..9a6a284d8 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -495,8 +495,8 @@ do -- experiment: names can change - local mppath = aux.mppath - local mpsize = aux.mpsize + local mppath = aux.path + local mpsize = aux.size local whitespace = lpegpatterns.whitespace local newline = lpegpatterns.newline @@ -522,12 +522,27 @@ do end local data = lpegmatch(pattern,io.loaddata(filename) or "") datasets[tag] = { - Data = data, - Line = function(n) mppath(data[n or 1]) end, - Size = function() mpsize(data) end, + data = data, + line = function(n) mppath(data[n or 1]) end, + size = function() mpsize(data) end, } end + table.setmetatablecall(datasets,function(t,k,f,...) + local d = datasets[k] + local t = type(d) + if t == "table" then + d = d[f] + if type(d) == "function" then + d(...) + else + mpvprint(...) + end + elseif t == "function" then + d(f,...) + end + end) + end -- \startluacode |