AddFunction

Kategorie: Script
Ab Engineversion: 9.0 OC

Beschreibung

Adds a function from a proplist, effect, definition, or object to the calling context.

Syntax

nil AddFunction(func call, bool override);

Parameter

call:
This is the function that should be added.
override:
[opt] Overriding an existing function in the target context is not allowed and will lead to a FatalError if this is set to false (default).

Anmerkung

When using this function be sure that you know what you are doing. Replacing functions can have unintended side effects.

Beispiel

  // Make a specific rock explode if it hits with high velocity!
  var boom = CreateObject(Rock);
  boom->AddFunction(Firestone.Hit2);
        
This script makes a rock explode like a firestone. Note that only this one specific function is copied, so there will be no fuse effect, for example.
Siehe auch: AddFunctions, GetFunctionName
Marky, 2019-04