diff options
author | Marius <mariausol@gmail.com> | 2011-11-14 17:20:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-11-14 17:20:14 +0200 |
commit | 6a3e98888c40dceb7b66c71f0804c1294c3d254a (patch) | |
tree | 54ace0130a827ef1e752d8ba615115a4934f183e /tex/context/base/util-seq.lua | |
parent | 76fc10b7a163b01e548aba40b0509d3a7d657a41 (diff) | |
download | context-6a3e98888c40dceb7b66c71f0804c1294c3d254a.tar.gz |
beta 2011.11.14 16:17
Diffstat (limited to 'tex/context/base/util-seq.lua')
-rw-r--r-- | tex/context/base/util-seq.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tex/context/base/util-seq.lua b/tex/context/base/util-seq.lua index 22733b022..3c5dc8ebb 100644 --- a/tex/context/base/util-seq.lua +++ b/tex/context/base/util-seq.lua @@ -176,9 +176,10 @@ local function construct(t,nodummy) end end t.dirty = false - if nodummy and #calls == 0 then + if nodummy and n == 0 then return nil else + -- n == 0 we could just return the variables variables = concat(variables,"\n") calls = concat(calls,"\n") if results then @@ -190,19 +191,21 @@ local function construct(t,nodummy) end end -sequencers.tostring = construct +sequencers.tostring = function(s) return construct(s,true) end sequencers.localize = localize local function compile(t,compiler,n) + local compiled if not t or type(t) == "string" then -- weird ... t.compiled = t .. so return false elseif compiler then - t.compiled = compiler(t,n) + compiled = compiler(t,n) else - t.compiled = construct(t) + compiled = construct(t,n) end - local runner = loadstring(t.compiled)() + local runner = compiled and loadstring(compiled)() + t.compiled = compiled t.runner = runner return runner -- faster end |