Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

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

Source code(UnigineScript)
// 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

Source code(UnigineScript)
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

Source code(UnigineScript)
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.s
Last update: 2017-07-03