summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-11-03 13:50:20 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-11-03 13:50:20 +0100
commitd644064076b183366f2ed688e1c7d33987d844f2 (patch)
treee817c6606f9035c209ed65314029a3525cee9141
parent566bf20237bde2a90fd9703aadb03b71e8d3281b (diff)
downloadluaotfload-d644064076b183366f2ed688e1c7d33987d844f2.tar.gz
[db] keep script state in static variable
-rw-r--r--luaotfload-database.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 755ad52..594e647 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -82,14 +82,15 @@ local tablefastcopy = table.fastcopy
local tabletofile = table.tofile
local tabletohash = table.tohash
+local runasscript = caches == nil
+
--- the font loader namespace is “fonts”, same as in Context
--- we need to put some fallbacks into place for when running
--- as a script
-fonts = fonts or { }
-fonts.names = fonts.names or { }
-fonts.definers = fonts.definers or { }
-
-local names = fonts.names
+fonts = fonts or { }
+fonts.names = fonts.names or { }
+fonts.definers = fonts.definers or { }
+local names = fonts.names --- font index namespace
config = config or { }
config.luaotfload = config.luaotfload or { }
@@ -148,7 +149,7 @@ patterns.splitcomma = splitcomma
created by different user.
--doc]]--
-if caches then
+if not runasscript then
local globals = names.path.globals
local names_dir = globals.names_dir