summaryrefslogtreecommitdiff
path: root/tex/context/base/meta-fun.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/meta-fun.lua')
-rw-r--r--tex/context/base/meta-fun.lua23
1 files changed, 11 insertions, 12 deletions
diff --git a/tex/context/base/meta-fun.lua b/tex/context/base/meta-fun.lua
index 9a6d971ba..7594d0c78 100644
--- a/tex/context/base/meta-fun.lua
+++ b/tex/context/base/meta-fun.lua
@@ -9,7 +9,6 @@ if not modules then modules = { } end modules ['meta-fun'] = {
-- very experimental, actually a joke ... see metafun manual for usage
local format, loadstring, type = string.format, loadstring, type
-local texwrite = tex.write
local metapost = metapost
@@ -17,42 +16,42 @@ metapost.metafun = metapost.metafun or { }
local metafun = metapost.metafun
function metafun.topath(t,connector)
- texwrite("(")
+ context("(")
if #t > 0 then
for i=1,#t do
if i > 1 then
- texwrite(connector or "..")
+ context(connector or "..")
end
local ti = t[i]
if type(ti) == "string" then
- texwrite(ti)
+ context(ti)
else
- texwrite(format("(%s,%s)",ti.x or ti[1] or 0,ti.y or ti[2] or 0))
+ context("(%s,%s)",ti.x or ti[1] or 0,ti.y or ti[2] or 0)
end
end
else
- texwrite("origin")
+ context("origin")
end
- texwrite(")")
+ context(")")
end
function metafun.interpolate(f,b,e,s,c)
local done = false
- texwrite("(")
+ context("(")
for i=b,e,(e-b)/s do
local d = loadstring(format("return function(x) return %s end",f))
if d then
d = d()
if done then
- texwrite(c or "...")
+ context(c or "...")
else
done = true
end
- texwrite(format("(%s,%s)",i,d(i)))
+ context("(%s,%s)",i,d(i))
end
end
if not done then
- texwrite("origin")
+ context("origin")
end
- texwrite(")")
+ context(")")
end