loadAtRoot
Definition
-- @/lua/common/extensions.lua:645
local function loadAtRoot(extPath, rootName)
-- log("I", logTag, "loadAtRoot called...")
if not rootName then
log("E", logTag, "loadAtRoot failed: root name not specified")
return
end
if string.find(rootName, "_") then
log("E", logTag, "loadAtRoot failed: root name cannot contain underscores")
return
end
if not string.find(extPath, "/") then
log("E", logTag, "loadAtRoot failed: extension path is not a valid file path")
return
end
if string.sub(extPath, 1, 1) == '/' then
extPath = string.gsub(extPath, "/(.*)", "%1") -- strip leading '/' if present
end
local extName
if string.len(rootName) > 0 then
extName = rootName..'_'..string.gsub(extPath, "(.*/)(.*)", "%2")
else
extName = string.gsub(extPath, "(.*/)(.*)", "%2")
end
local m = extensionLoadInternal(extName, extPath)
if m then
m.__manuallyLoaded__ = true
m.__originalExtPath__ = extPath
end
resolveDependencies()
table.clear(luaExtensionFuncs) -- clear the hook function cache
processLoadedFreshList()
return extName, m
end
Callers
@/lua/ge/extensions/scenario/scenarios.lua
local m
e.extName, m = extensions.loadAtRoot(moduleFullPath, "scenario")
e.loaded = m ~= nil
@/lua/ge/extensions/freeroam/freeroam.lua
if not FS:fileExists(file..'.lua') then return end
extensions.loadAtRoot(file,"")
if mainLevel and mainLevel.onClientPreStartMission then
@/lua/common/extensions.lua
if not package.loaded[path] then
-- because of loadAtRoot()
if not m.__originalExtPath__ and not package.loaded[m.__originalExtPath__] then
-- without it, vehicle extensions like custom_input would come out as custom/input which is wrong
loadAtRoot(file:sub(1,-5), "")
end
end
loadAtRoot(extPath, root)
end