JS Functions
The following functions are defined for the object js that is used to execute any JavaScript expression or call functions defined on the JavaScript side from the UnigineScript code. These functions are available for UnigineScript only.
Variable js.eval (string src)
Executes the specified JavaScript expression and returns the result of its execution.Arguments
- string src - An arbitrary JavaScript expression.
Return value
The result of the executed expression.Examples
// call a function without arguments
int enabled = js.eval("isEnabled()");
// call a function with one argument
js.eval(format("hideSection('%s')","resolution"));
Variable js.call (string name)
Executes the function with no arguments defined on the JavaScript.Arguments
- string name - A name of the function defined on the JavaScript side.
Return value
The result that the executed function has returned.Examples
js.call("isEnabled");
Variable js.call (string name, Variable a0)
Executes the function with 1 argument defined on the JavaScript.Arguments
- string name - A name of the function defined on the JavaScript side.
- Variable a0 - A function argument.
Return value
The result that the executed function has returned.Examples
js.call("hideSection","resolution");
Variable js.call (string name, Variable a0, Variable a1)
Executes the function with 2 arguments defined on the JavaScript.Arguments
- string name - A name of the function defined on the JavaScript side.
- Variable a0 - The 1st argument of the function.
- Variable a1 - The 2nd argument of the function.
Return value
The result that the executed function has returned.Variable js.call (string name, Variable a0, Variable a1, Variable a2)
Executes the function with 3 arguments defined on the JavaScript.Arguments
- string name - A name of the function defined on the JavaScript side.
- Variable a0 - The 1st argument of the function.
- Variable a1 - The 2nd argument of the function.
- Variable a2 - The 3rd argument of the function.
Return value
The result that the executed function has returned.Variable js.call (string name, Variable a0, Variable a1, Variable a2, Variable a3)
Executes the function with 4 arguments defined on the JavaScript.Arguments
- string name - A name of the function defined on the JavaScript side.
- Variable a0 - The 1st argument of the function.
- Variable a1 - The 2nd argument of the function.
- Variable a2 - The 3rd argument of the function.
- Variable a3 - The 4th argument of the function.
Return value
The result that the executed function has returned.sLast update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter