Functions Index :: L :: LoadModule
LoadModule(string library, string package, string module)
Loads the specified module making its code and global data available to scripts.
In coopearion with DefineModule ensures that the module is loaded just once.
library: The name of the library where the module belongs (is part of).
package: The name of the package where the module belongs.
module: The name of the module.
Notes and conditions on arguments relations:
Third party libraries must be structured in a way similar to AVSLib for this function to be interoperable (see the "Using the loader module to build Avisynth script libraries" backgrounder).
dummy = LoadModule("avslib", "numeric", "rounding")
dummy = LoadModule("avslib", "array", "core")
: User code must assign the return value of the function to a dummy variable if the last special Avisynth global variable is used by the script. Else, last will be the function's return value (usually not a clip and in any case not the clip intended by the script writer).
This is of concern if the call to the function is made at the middle or near the end of the script and the script's coding style makes use of the implicit assignment to last (ie filter / function calls do not assign their value to a variable).
: The package may be further divided to an unlimited hierarchy of subpackages, if each level is separated by the "/" (slash) character.
Each slash character corresponds to a path separator in the underlying OS, thus to a nested subfolder in the package tree.
The following examples illustrate the concept:
- The string "array" defines a one level hierarchy: package array (an "array" folder inside the root folder of the library's distribution).
- The string "array/transforms" defines a two level hierarchy: package array, subpackage transforms (a "transforms" folder inside the "array" folder).
- The string "array/transforms/affine" defines a three level hierarchy: package array, subpackage transforms (a "transforms" folder inside the "array" folder), sub-subpackage affine (an "affine" folder inside the "transforms" folder).