set_native_filter
native set_native_filter(const handler[]);
| Parameter |
Description |
| handler | Function name to call |
Sets a native filter, letting the plugin intercept and handle an
automatic native requirement.
This has to be used inside the plugin_native() forward, otherwise it
has no effect.
This is useful for creating plugins that can dynamically decide which
modules or features to use at runtime, often necessary for cross-mod
plugins. It allows to deploy a single version of the plugin instead
of compiling multiple versions for each use-case.
The handler will be called in the following manner:
public native_filter(const native[], index, trap)
native - Native name
index - Native index
trap - 0 if native couldn't be found, 1 if native use was attempted
The handler should return PLUGIN_CONTINUE to let the error through the
filter (which will throw a run-time error), or return PLUGIN_HANDLED
to continue operation.
Returning PLUGIN_CONTINUE if trap is 0 will result in the plugin
failing to load!
1 if handler is set successfully, 0 otherwise (called
outside of plugin_native() forward)
If an invalid callback function is provided, an error is
thrown.