[antum] Add parameter 'lua_ext' to 'antum.loadScript' function:
If 'true', appends '.lua' extension to script filename.
This commit is contained in:
parent
0d0947ec40
commit
0d17736b38
@ -61,9 +61,26 @@ function antum.getCurrentModPath()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Loads a mod sub-script
|
--[[
|
||||||
function antum.loadScript(script_name)
|
Loads a mod sub-script.
|
||||||
local script = antum.getCurrentModPath() .. '/' .. script_name .. '.lua'
|
|
||||||
|
@param script_name
|
||||||
|
Name or base name of the script file
|
||||||
|
@param lua_ext
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
|
description: If 'true', appends '.lua' extension to script filename
|
||||||
|
]]--
|
||||||
|
function antum.loadScript(script_name, lua_ext)
|
||||||
|
-- Default 'true'
|
||||||
|
if lua_ext == nil then
|
||||||
|
lua_ext = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local script = antum.getCurrentModPath() .. '/' .. script_name
|
||||||
|
if lua_ext then
|
||||||
|
script = script .. '.lua'
|
||||||
|
end
|
||||||
|
|
||||||
if antum.fileExists(script) then
|
if antum.fileExists(script) then
|
||||||
dofile(script)
|
dofile(script)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user