summaryrefslogtreecommitdiff
path: root/script-beta/library.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/library.lua')
-rw-r--r--script-beta/library.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/script-beta/library.lua b/script-beta/library.lua
index bbd540cd..78321d6a 100644
--- a/script-beta/library.lua
+++ b/script-beta/library.lua
@@ -310,23 +310,23 @@ end
local function compileMetaDoc()
local langID = lang.id
local version = config.config.runtime.version
- local metaDir = ROOT / 'meta' / config.config.runtime.meta:gsub('%$%{(.-)%}', {
+ m.metapath = ROOT / 'meta' / config.config.runtime.meta:gsub('%$%{(.-)%}', {
version = version,
language = langID,
})
- if fs.exists(metaDir) then
+ if fs.exists(m.metapath) then
return
end
- fs.create_directory(metaDir)
+ fs.create_directory(m.metapath)
local templateDir = ROOT / 'meta' / 'template'
for fullpath in templateDir:list_directory() do
local filename = fullpath:filename()
local metaDoc = compileSingleMetaDoc(util.loadFile(fullpath:string()))
- util.saveFile((metaDir / filename):string(), metaDoc)
+ util.saveFile((m.metapath / filename):string(), metaDoc)
end
end
-local function init()
+local function initFromLni()
local id = lang.id
m.global = util.container()
m.library = util.container()
@@ -361,10 +361,25 @@ local function init()
markLibrary(m.object)
markLibrary(m.other)
markLibrary(m.custom)
+end
+local function initFromMetaDoc()
+ m.global = util.container()
+ m.library = util.container()
+ m.object = util.container()
+ m.other = util.container()
+ m.custom = util.container()
compileMetaDoc()
end
+local function init()
+ if DEVELOP then
+ initFromMetaDoc()
+ else
+ initFromLni()
+ end
+end
+
function m.reload()
init()
end