summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-01-29 17:47:57 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2017-01-29 17:48:00 +0100
commit0baccc9623891f57a302d51d40a3d1c380d910d0 (patch)
tree3a358eb8d503787986355869ce32a2eb8341feba
parent17a5da03053805591b11e960d0126db7f1ba4184 (diff)
downloadluaotfload-0baccc9623891f57a302d51d40a3d1c380d910d0.tar.gz
[main] make main() no-op when called again
Fix #390 Suggested by @davidcarlisle.
-rw-r--r--src/luaotfload-main.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index 83ce5e7..bbe09fa 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -246,8 +246,18 @@ local install_loaders = function ()
return loaders
end
+local luaotfload_initialized = false --- prevent multiple invocations
+
luaotfload.main = function ()
+ if luaotfload_initialized then
+ logreport ("log", 0, "load",
+ "Luaotfload initialization requested but is already \z
+ loaded, ignoring.")
+ return
+ end
+ luaotfload_initialized = true
+
luaotfload.loaders = install_loaders ()
local loaders = luaotfload.loaders
local loadmodule = loaders.luaotfload