VM namespace

Virtual Machine (VM) related methods and properties.

Methods of this namespace are not always available to the script - they depend on feature parameters of VM creation.

Constants

Methods

getProperty
(obj: any, name: string | symbol): any | undefined

Gets property of obj by its name.

Equivalent of const name = "..."; var val = obj.(name);

setProperty
(obj: any, name:string | symbol, val: any): any | undefined

Sets property of obj by its name.

Equivalent of const name = "..."; obj.(name) = val;

entityId
(entity: any) : integer

Returns "unique" identifier of an entity. For heap allocated entities (object, array, string, etc) it returns some sequential number (int32).  For value types (integer, float, length, etc.) it returns value of hash(entity). Note that uniqueness of id is not strict - there is very low but still probability of conflicts.

Properties

unhandledExceptionHandler
r/w, function - global unhandled exception handler. Accepts function(err) : true | false that will receive error object. If that function returns true then the exception is considered as handled and will not be output to stderr port.
pendingAsyncTasks
r-only - list of pending (active) async tasks: 
for (var task in VM.pendingAsyncTasks)
  debug task: task.function.fullName;