

This is a global built in package that provides information about the modules available and functions for their use.
Modules are package files placed locally in 'modules' subdirectory under the program installation folder.
Interface
activate
function activate(name)
Requests the activation of a specified module. For some modules, the process is asynchronous, requiring communication
with the host before the activation is completed.
Parameters
name (string)
The name of the module being targeted by the operation
deactivate
function deactivate(name)
Requests the deactivation of the given module. Host deactivation will not cause unloading of locally loaded client modules,
only shared data. See setModulePermissions for more information.
Parameters
name (string)
The name of the module being targeted by the operation
export
function export(name, category, author, filename, thumbnail, nodes, tokens)
Note: Rulesets with compatibility version less than 3.0 expect a different set of parameters (name [string], file [string], author [string], nodes [table], nodes [table], nodes [table], thumbnail [string]).
Exports a set of database nodes, images and tokens to a Fantasy Grounds compatible data module.
Parameters
name (string)
The visible name of the new module.
category (string)
The category of the new module.
author (string)
The author of the new module.
filename (string)
The file name of the new module.
thumbnail (string)
The file name of the thumbnail graphic which should be used for the module.
nodes (table)
A table of string values indicating the database node identifiers for the nodes which should be exported.
tokens (table)
A table of string values indicating the file names for the tokens which should be exported as host module data.
Return values
(boolean)
A value of true will be returned if the export is successful, otherwise a value of false will be returned.
getModuleInfo
function getModuleInfo(name)
This function can be used to retrieve information about a particular module. The returned table contains information in
the following fields:
- name
- category
- author
- size
-
installed (on local machine)
- loaded
-
loading (from host machine)
-
loadpending (active request to host machine)
-
permission (none, disallow, allow, autoload)
-
intact (host only)
-
replaces (which other modules does this one override)
- hastokens
- hasdata
Parameters
name (string)
The name of the module being targeted by the operation
Return values
(table)
A table containing information about the module, see above for details
getModules
function getModules()
This function returns a list of modules available. The list will include locally available modules compatible with the
current ruleset, as well as modules requested for use by clients (for the host) or loaded host modules with shared data
(for clients).
To get more information on a module, see getModuleInfo.
Return values
(table)
An integer indexed table of string values containing the names of the modules available.
onActivationRequested
function onActivationRequested(name)
This event is fired when a client requests loading a module that does not have its permissions set. The request will remain
pending (with the module not loaded) on the client until the host acknowledges the request by blocking or allowing the operation.
Parameters
name (string)
The name of the module causing the event
onModuleAdded
function onModuleAdded(name)
This event is fired when a new module is added to the list of modules. This might occur either due to clients requesting
to load a module not installed on the host computer (when running as host) or the host activating modules not found locally
on client computers and containing shared data (when running as a client).
Parameters
name (string)
The name of the module causing the event
onModuleLoad
function onModuleLoad(name)
This event is fired when a module is loaded.
Parameters
name (string)
The name of the module causing the event
onModuleRemoved
function onModuleRemoved(name)
This event is fired when a module is removed from the list of modules. This will occur on clients when the host unloads
modules containing shared data not found as a local installation.
Parameters
name (string)
The name of the module causing the event
onModuleUnload
function onModuleUnload(name)
This event is fired when a module is unloaded.
Parameters
name (string)
The name of the module causing the event
onModuleUpdated
function onModuleUpdated(name)
This event is fired when some properties of a module are changed, typically requiring updating of a module listing interface.
See the getModuleInfo function for more information on module properties.
Parameters
name (string)
The name of the module causing the event
onUnloadedReference
function onUnloadedReference(name)
This function is called when an attempt is made to open a new top level window for data contained in an unloaded module.
Returning a value other than true will cause the window creation to fail, as will not having the module
loaded after this function returns.
Parameters
name (string)
The name of the module causing the event
Return values
(boolean)
A value of true will force the engine to retry opening the window with the given module
data source. Otherwise, the creation of the requested top level window fails.
revert
function revert(name)
Removes all user modifications to data loaded from the specified module, reverting it back to the original contents.
Parameters
name (string)
The name of the module being targeted by the operation
setModulePermissions
function setModulePermissions(name, allow, autoload)
Sets the loading permissions for the given module. This function will fail if called from a client mode script.
Parameters
name (string)
The name of the module being targeted by the operation
allow (boolean)
A value of true to allow clients to load the module, or false
to prohibit loading
autoload (boolean)
If true, all clients that can access the module will automatically load it.
The second parameter must be true for this parameter to have any effect.