Functions Index :: L :: LoadPackage
LoadPackage(string library, string package)
Loads the specified package making its code and global data available to scripts.
In coopearion with DefinePackage ensures that the package is loaded just once.
library: The name of the library where the package belongs (is part of)
package: The name of the package.
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 = LoadPackage("avslib", "numeric")
dummy = LoadPackage("avslib", "array")
: 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).