public class GameScript
public GameScript(@NotNull com.github.lazoyoung.craftgames.api.script.ScriptFactory.Engine engine, @NotNull java.io.File file, @NotNull kotlin.text.Regex regex)
public boolean getDebug()
public void setDebug(boolean p)
@NotNull protected java.lang.String getName()
@NotNull protected java.io.File getLogRoot()
public void bind(@NotNull java.lang.String arg, @NotNull java.lang.Object obj)
public void print(@NotNull java.lang.String message)
public void printDebug(@NotNull java.lang.String message)
public void parse()
Compiles the script to achieve efficient executions in the future.
public void run()
Executes entire script.
Some script engine specification requires ModuleService.injectModules before execution.
IllegalStateException
- is thrown if this engine
requires the script to have modules injected before execution.Exception
- Any exception may occur during script evaluation.@Nullable public java.lang.Object invokeFunction(@NotNull java.lang.String name, @NotNull java.lang.Object... args)
Invokes specific function defined at top-most context in the COMPILED SCRIPT.
Some script engine specification requires ModuleService.injectModules before execution.
name
- Name of the function to invoke.args
- Array of arguments passed to this function.IllegalStateException
- is thrown if this engine
requires the script to have modules injected before execution.Exception
- Any exception may occur during script evaluation.@NotNull public com.github.lazoyoung.craftgames.api.script.ScriptFactory.Engine getEngine()