Miscellaneous Lua Topics
Register Post-Run Functions
In LuaTeX, it is possible to register a callback function that gets executed at the end of a run. Like so:
id, err = callback.register('stop_run', new_stop_run_function)
But ConTeXt doesn't allow
stop_run callbacks to be registered. If you attempt to,
err will be set to "callback 'stop_run' is frozen (actions performed at the end of a run)".
Instead, ConTeXt provides two methods for executing actions at the end of a run, depending on the purpose of the action.
For actions whose primary purpose is to display a message or report some statistic, use:
statistics.register("banner",function() return "text" end)
The function passed in should return either a string to be reported, or false (or nil) which will not show the statistic. (The latter makes sense if there there ends up being nothing useful to report.)
For actions whose primary purpose is to perform some post-run processing, use: