Ab Engineversion: 9.0 OC
Adds several functions to the calling context, by calling AddFunction on each item in the array.
nil AddFunctions(array functions, bool override);
- These functions will be added. Each item may come from a different source.
- [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). This is not checked beforehand, but only when the function is being added, so other functions may have already been added, but you receive an error only on the first function that already exists.
When using this function be sure that you know what you are doing. Replacing functions can have unintended side effects.
// Make a specific rock explode if it hits with high velocity! var boom = CreateObject(Rock); boom->AddFunctions([Firestone.Hit, Firestone.Hit2, Firestone.Fuse], true);
This script makes a rock behave like a firestone. Note that Rock already has a function Hit(), therefore the override parameter is set to true, or the function reports an error.