This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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
Build: ()