Function xsCall

Call a Function.

xs.bindings.xsSlotRecord xsCall (
  scope xs.bindings.xsMachineRecord* the,
  const(xs.bindings.xsSlotRecord) this_,
  short id,
  const(xs.bindings.xsSlotRecord[]) params...
);

When a property or item of an instance is a reference to a function, you can call the function with the xsCall template. If the property or item is not defined by the instance or its prototypes or is not a reference to a function, xsCall throws an exception.

Parameters

NameDescription
theA machine
this_A reference to the instance that will have the property or item
idThe identifier of the property or item to call
paramsThe parameter slots to pass to the function

Returns

The function's return value slot.

Examples

In ECMAScript:

foo()
this.foo(1)
this[0](2, 3)

In D:

xsCall(xsGlobal, xsID_foo);
xsCall(xsThis, xsID_foo, xsInteger(1));
xsCall(xsThis, 0, xsInteger(2), xsInteger(3));