set_native_filter
- Синтаксис
-
native set_native_filter(const handler[]);
Переменная | Описание |
---|---|
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)