Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Move initialization to the Lua module itself #323

Closed
wants to merge 2 commits into from
Closed

Move initialization to the Lua module itself #323

wants to merge 2 commits into from

Conversation

kalrish
Copy link

@kalrish kalrish commented Feb 7, 2016

Currently, luaotfload.sty loads the luaotfload-main Lua module and then (inmediatly) runs an initialization function (luaotfload.main()) offered by this module. This function is, in fact, never run again, and isn't intended to be run more than once, AFAICT.

Instead, do initialization directly in the Lua module, straight away.

Motivation behind this change:
One may want to dump a custom format (with LuaTeX). In order to make it feasible and useful, one has to dump all Lua modules in the format. To do this, one could hook into require's second searcher so as to save the loader function that it gets in a bytecode register. However, with the current state of affairs, this approach fails to save the initialization step done by calling luaotfload.main(). This can be solved by moving initialization to the Lua module itself.

@phi-gamma
Copy link
Member

···<date: 2016-02-07, Sunday>···<from: Kalrish Bäakjen>···

Currently, luaotfload.sty loads the luaotfload-main Lua
module and then (inmediatly) runs an initialization function
(luaotfload.main()) offered by this module. This function is,
in fact, never run again, and isn't intended to be run more than
once, AFAICT.

The rationale is to separate module loading from execution. This
is by design.

One may want to dump a custom format (with LuaTeX). In order to
make it feasible and useful, one has to dump all Lua modules in
the format. To do this, one could hook into require's second
searcher so as to save the loader function that it gets in a
bytecode register. However, with the current state of affairs,
this approach fails to save the initialization step done by
calling luaotfload.main(). This can be solved by moving
initialization to the Lua module itself.

What’s wrong with wrapping Luaotfload in another Lua module and
then calling main() from there?

@phi-gamma phi-gamma closed this Feb 11, 2016
@phi-gamma
Copy link
Member

Instead, do initialization directly in the Lua module, straight away.

BTW, we could make this a configuration option: Depending on
some variable, the main() would be executed directly after
loading the module. Open an issue if you’re still interested.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants