From 62ffb56df1dcfa53aa0df0ea0a1ab574bfb2f173 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Tue, 16 Apr 2024 10:00:20 +0900 Subject: [PATCH] ltj-base.lua: re-init \e@alloc@luafunction@count (#5) --- src/ltj-base.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ltj-base.lua b/src/ltj-base.lua index 2af3908..e112dfa 100644 --- a/src/ltj-base.lua +++ b/src/ltj-base.lua @@ -398,6 +398,19 @@ function ltjb.add_to_callback(name,fun,description,priority) return end +--- fix \e@alloc@luafunction@count (gh:5) +do + local t = lua.get_functions_table() + local m = 0 + local n = tex.getcount('e@alloc@luafunction@count') + for i = 1,math.max(n, #t)+100 do-- I think 100 is sufficient + if t[i] then m = i end + end + if m>n then + tex.setcount('global', 'e@alloc@luafunction@count', m) + end +end + -------------------- mock of debug logger if not ltjb.out_debug then local function no_op() end -- 2.11.0