diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-05 23:22:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-05 23:22:36 +0000 |
commit | 7ef0c5b362e4df3e85449f3c397ca3b61edf15a0 (patch) | |
tree | ca33364f8dca69a80a40985834e5726448ba6746 /Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua | |
parent | 17efbb93c3c280ebec43438b10c53601758ef11e (diff) |
lualibs (4feb17)
git-svn-id: svn://tug.org/texlive/trunk@43153 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua index e1dcdc94d57..b3346006c94 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-lua.lua @@ -158,3 +158,21 @@ end -- luautilities.registerdatatype(lpeg.P("!"),"lpeg") -- -- print(luautilities.datatype(lpeg.P("oeps"))) + +-- These finalizers will only be invoked when we have a proper lua_close +-- call (which is not happening in luatex tex node yes) or finish with an +-- os.exit(n,true). + +local finalizers = { } + +setmetatable(finalizers, { + __gc = function(t) + for i=1,#t do + pcall(t[i]) -- let's not crash + end + end +} ) + +function luautilities.registerfinalizer(f) + finalizers[#finalizers+1] = f +end |