Files

1.2 KiB

IScriptServer.print

← IScriptServer · ← Master

Parça 2/2 · önceki

c.getServer().executeScript("example_script.js", "custom_function");

Parameters: scriptName - The name of the script to execute. function - The name of the function within the script to execute.

executeScript

void executeScript(java.lang.String scriptName, java.lang.String function, java.lang.Object... args)

Execute a script with a given script name, a specified function and arguments.

c.getServer().executeScript("example_script.js", "func_with_context", c, 1, 2, 3); c.getServer().executeScript("example_script.js", "func_without_context", 1, 2, 3);

// example_script.js function func_with_context(c, arg1, arg2, arg3) { c.send("arg1: " + arg1 + ", arg2: " + arg2 + ", arg3: " + arg3); }

function func_without_context(arg1, arg2, arg3) {


print("arg1: " + arg1 + ", arg2: " + arg2 + ", arg3: " + arg3); }

Parameters: scriptName - The name of the script to execute. function - The name of the function within the script to execute. args - The arguments to pass to the function.