Skip to main content

MTScript Library functions

The following functions have been added to MapTool Macro Script to work with libraries.

library.listAddOnLibraries
Usage:
library.listAddOnLibraries()

List the Add-On Libraries in the current Campaign.
library.getInfo
Usage:
library.getInfo(
namespace
)
Parameters
  • namespace
    The namespace of the library

Returns the information about a library (either Add-On or Lib:Token)
library.listTokenLibraries
Usage:
library.listTokenLibraries()

Lists the Lib:Tokens in the Campaign
library.getContents
Usage:
library.getContents(
namespace
)
Parameters
  • namespace
    The namespace of the library

Lists the contents of a library

Add-On Libraries and Data

As Add Ons do not live on a token there are no token properties for them. Instead, there has been a new area created for storing data that is a lot more flexible -- and will allow data to be stored against other entities like maps in the future.

For backwards compatibility the existing lib property functions below have been modified to work with this new data store if called with an add-on as the target.

  • setLibProperty()
  • getLibProperty()
  • getLibPropertyNames()
  • getMatchingLibProperties()

For new development it is recommended to use the new data functions for storage rather than the above compatibility functions as they give you greater flexibility in defining what type the data should be (e.g. string, number, JSON, etc). See MTScript Data Functions