Name
REQUIRE -- declare a plugin dependency (V5.0)
Synopsis
@REQUIRE plugin$[, table]
Function
This preprocessor command allows you to declare an external plugin dependency which your script requires to run. If you use this preprocessor command, Hollywood will make sure that the specified plugin is installed before running your script. Optionally, you can pass additional parameters to the plugin which allows you to control how the plugin is initialized.

Please note that although Hollywood loads all plugins automatically on startup, many plugins require you to call @REQUIRE before they can be used. This is because these plugins need custom initialization code which is only run if you explicitly call @REQUIRE on them. For example, plugins which install a display adapter will not be activated unless you call @REQUIRE on them. Plugins which just add a loader or saver for additional file formats, however, will be automatically activated even if you don't call @REQUIRE on them.

This preprocessor command can also be used to load plugins which have been exempt from automatic loading at startup. Plugins can be exempt from auto-loading by prefixing their filename with an underscore character ('_') or by using the ‘-skipplugins’ console argument. If you want to load a plugin that has been skipped by the auto loader, just call @REQUIRE on it from your script and it will be loaded by the preprocessor. Alternatively, you can also load these plugins using the LoadPlugin() function.

Starting with Hollywood 6.0 this preprocessor command accepts an optional table argument which allows you to pass additional parameters to the plugin's initialization routine. The parameters accepted here vary from plugin to plugin. Please consult the documentation of the plugin to find out if it accepts any additional parameters that can be passed to @REQUIRE. The following two parameters are supported for every plugin:

Version:
Minimum plugin version required. Hollywood will fail if the installed plugin does not have at least this version number. This defaults to 0 which means that any version will do. (V6.0)

Revision:
Minimum plugin revision required. Hollywood will fail if the installed plugin does not have at least this revision number. This defaults to 0 which means that any revision will do. (V6.0)

Link:
If this tag is set to True, the specified plugin will be linked into your executable when compiling your script. This will only work if you've set up the plugin linker infrastructure correctly. See Linking plugins for details. Make sure to carefully read the licenses of all plugins you link to your executable because licenses like LGPL affect your project if you statically link against LGPL software. This tag defaults to False which means that the plugin won't be linked. (V7.0)

Please note that you must not specify an absolute path in plugin$. Just pass the name of the plugin.

See Plugins for more information on plugins.

Inputs
plugin$
name of the required plugin
table
optional: table containing further options to be passed to the plugin (V6.0)
Example
@REQUIRE "xmlparser"
Declares that your script requires the "xmlparser.hwp" plugin to be installed. Any version will be accepted.


@REQUIRE "myplugin", {Version = 2, Revision = 1, User = "John"}
The code above checks for version 2.1 of "myplugin.hwp" and also passes the additional argument "User=John" to the plugin's initialization code.

Show TOC