diff options
Diffstat (limited to 'macros/luatex/generic/lualibs/lualibs-io.lua')
-rw-r--r-- | macros/luatex/generic/lualibs/lualibs-io.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/macros/luatex/generic/lualibs/lualibs-io.lua b/macros/luatex/generic/lualibs/lualibs-io.lua index a955262a31..6bf7a97bda 100644 --- a/macros/luatex/generic/lualibs/lualibs-io.lua +++ b/macros/luatex/generic/lualibs/lualibs-io.lua @@ -147,9 +147,12 @@ function io.copydata(source,target,action) end end -function io.savedata(filename,data,joiner) - local f = open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f = open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end") > 0 then + f:write(joiner) + end if type(data) == "table" then f:write(concat(data,joiner or "")) elseif type(data) == "function" then @@ -288,7 +291,8 @@ end io.noflines = noflines --- inlined is faster ... beware, better use util-fil +-- inlined is faster ... beware, better use util-fil so these are obsolete +-- and will go local nextchar = { [ 4] = function(f) |