Method

Method

Clone: Method newObj = Method(other);

Method contains a callable script method.

See also Signal

Static Methods

static Method Create(string aMethodName)

Returns a new Method pointing to the global function named aMethodName. Method m = Method.Create(“my_func”);

static Method Create(Object aObject, string aMethodName)

Returns a new Method pointing to aObject’s method named aMethodName. Method m = Method.Create(PLATFORM, “my_func”);

Methods

Object Call()

Executes a method that takes no parameters. Returns the return value of the method.

Object Call(Array<Object> aParameters)

Executes a method that takes parameters. aParameters is an array containing the parameters to be passed to the method. Returns the return value of the method.

Object Base()

Returns the object that owns the method. Null for global methods.

string Name()

Returns the name of the method.

Method Bind(int aParameterIndex, Object aValue)

Returns a new method with one of the method’s parameters bound to a value. The new method takes one less parameter. This can be useful when adding callbacks to waypoints. Example:

script print_data(string s)
   writeln(s);
end_script
...
script use_method()
   Method m = Method.Create("print_data");
   Method bm = m.Bind(0, "Bound Value");
   // bm takes no arguments.  This will print "Bound Value":
   bm.Call();
end_script