Package com.avrix.lua
Class LuaManager
java.lang.Object
com.avrix.lua.LuaManager
Provides utility methods for managing Lua scripts.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addBlockLua
(String luaFileName) Adds a Lua file name to the blocked list.static void
addLuaActiveFolder
(File folder) Adds the specified folder to the active Lua path.Retrieves the set of blocked Lua file names.static boolean
isLuaBlocked
(String luaFileName) Checks if a Lua file name is blocked by performing a partial match against the blocked Lua file names.static void
loadLuaFromFolder
(String folderPath, boolean rewriteEvents) Searches for Lua files recursively in the specified folder and its subfolders, adds them to the paths collection, and then runs each Lua file.static void
Executes a Lua script located at the specified path.
-
Constructor Details
-
LuaManager
public LuaManager()
-
-
Method Details
-
addBlockLua
Adds a Lua file name to the blocked list.- Parameters:
luaFileName
- the full (or partial) name of the Lua file to be blocked
-
getBlockedLua
Retrieves the set of blocked Lua file names.- Returns:
- a
Set
containing the names of blocked Lua files
-
isLuaBlocked
Checks if a Lua file name is blocked by performing a partial match against the blocked Lua file names.- Parameters:
luaFileName
- the name of the Lua file to check- Returns:
true
if a partial match is found in the blocked list, otherwisefalse
-
runLua
Executes a Lua script located at the specified path.- Parameters:
path
- The path to the Lua script.rewriteEvents
- Determines whether to rewrite events in the Lua script.
-
loadLuaFromFolder
Searches for Lua files recursively in the specified folder and its subfolders, adds them to the paths collection, and then runs each Lua file. After all files are loaded, fires the `OnLuaFilesLoaded` event- Parameters:
folderPath
- The path to the folder containing Lua files.rewriteEvents
- A boolean indicating whether to rewrite events.
-
addLuaActiveFolder
Adds the specified folder to the active Lua path. Adding a folder will allow lua files to access other lua files inside the folder via 'require'- Parameters:
folder
- the folder to add to the Lua path
-