Functions Index :: L :: LoadPackage

[<< up one level]


:: loader


LoadPackage(string library, string package)


Loads the specified package making its code and global data available to scripts.[1]

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.[2]

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")


[<< top]


[1]: 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).

[2]: 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: