Package com.avrix.lua
Class LuaManager
java.lang.Object
com.avrix.lua.LuaManager
Provides utility methods for managing Lua scripts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddBlockLua(String luaFileName) Adds a Lua file name to the blocked list.static voidaddLuaActiveFolder(File folder) Adds the specified folder to the active Lua path.Retrieves the set of blocked Lua file names.static booleanisLuaBlocked(String luaFileName) Checks if a Lua file name is blocked by performing a partial match against the blocked Lua file names.static voidloadLuaFromFolder(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 voidExecutes 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
Setcontaining 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:
trueif 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
-