Class LuaManager
java.lang.Object
com.toxicrain.rainengine.core.lua.LuaManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
categorizeScripts
(String directoryPath) static void
Executes all Lua scripts.static void
Executes all init scripts.static void
executeMapScript
(String mapName) Executes a map scriptstatic void
Executes all init scripts.static void
Executes all tick scripts.static boolean
isImguiFile
(String fileName) Determines if the given file name indicates that it is an "imgui" script.static boolean
isInitFile
(String fileName) Determines if the given file name indicates that it is an "init" script.static boolean
isMapAutorunFile
(String fileName) Determines if the given file name indicates that it is a "tick" script.static boolean
isPostInitFile
(String fileName) Determines if the given file name indicates that it is an "postinit" script.static boolean
isTickFile
(String fileName) Determines if the given file name indicates that it is a "tick" script.static void
loadScript
(String scriptPath) Loads and executes a Lua script from the specified path.static void
loadScript
(String scriptPath, String relativePath) Loads and executes a Lua script from the specified path.
-
Constructor Details
-
LuaManager
public LuaManager(org.luaj.vm2.Globals globals)
-
-
Method Details
-
isInitFile
Determines if the given file name indicates that it is an "init" script.- Parameters:
fileName
- the name of the Lua file- Returns:
- true if the file is an "init" script, false otherwise
-
isPostInitFile
Determines if the given file name indicates that it is an "postinit" script.- Parameters:
fileName
- the name of the Lua file- Returns:
- true if the file is an "postinit" script, false otherwise
-
isImguiFile
Determines if the given file name indicates that it is an "imgui" script.- Parameters:
fileName
- the name of the Lua file- Returns:
- true if the file is an "imgui" script, false otherwise
-
isTickFile
Determines if the given file name indicates that it is a "tick" script.- Parameters:
fileName
- the name of the Lua file- Returns:
- true if the file is a "tick" script, false otherwise
-
isMapAutorunFile
Determines if the given file name indicates that it is a "tick" script.- Parameters:
fileName
- the name of the Lua file- Returns:
- true if the file is a "autorun" script, false otherwise
-
categorizeScripts
-
executeInitScripts
public static void executeInitScripts()Executes all init scripts. -
executePostInitScripts
public static void executePostInitScripts()Executes all init scripts. -
executeTickScripts
public static void executeTickScripts()Executes all tick scripts. -
executeMapScript
Executes a map script -
executeAllImguiScripts
public static void executeAllImguiScripts()Executes all Lua scripts. -
loadScript
Loads and executes a Lua script from the specified path.- Parameters:
scriptPath
- the relative path to the Lua script file within the "resources/scripts/" directory
-
loadScript
Loads and executes a Lua script from the specified path.- Parameters:
scriptPath
- the path to the Lua script filerelativePath
- the relative path to the script Ex: "resources/scripts/"
-