LiveCode Builder (Library) Extensions

Use revIgniter's loading mechanism to load LiveCode Builder (library) extensions.

revIgniter does not load Extension Files by default, so the first step in using an Extension is to load it. Once loaded, it becomes globally available in your controller.

Extensions are typically stored in your system/extensions, or application/extensions directory. revIgniter will look first in your application/extensions directory. If the directory does not exist or the specified extension is not located there revIgniter will instead look in your global system/extensions folder.

Loading an Extension

Loading a LB (library) extension file is quite simple using the following handler:

rigLoadExtension "folderName"

Where folderName is the name of a folder (containing a "module.lcm" file) located in application/extensions or in system/extensions. Please follow the naming convention used by LiveCode Ltd. This means such a folder name should be composed of a reverse domain, followed by "library" and a library name all delimited by a period.

For example, to load the LiveCode JSON extension, which can be extracted from the main LiveCode distribution and should be located in application/extensions/, you will do this:

rigLoadExtension "com.livecode.library.json"

If you need to specify a resource path for the extesnion you can do so by appending a path to the extension folder name relative to the folder like:

rigLoadExtension ""

An extension can be loaded anywhere within your controller handlers, as long as you load it before you use it.

Note: The Extension loading handler above does not return a result value, so don't try to assign the result to a variable. Just use it as shown.

Loading Multiple Extensions

If you need to load more than one extension you can specify them in a comma separated list, like this:

put "com.livecode.library.json,com.myDomain.library.myExtension1/support,com.myDomain.library.myExtension2" into tExtensions
rigLoadExtension tExtensions

Or you can specify them in an array, like this:

split tExtensions using comma
rigLoadExtension tExtensions

Auto-loading Extensions

If you find that you need a particular extension globally throughout your application, you can tell revIgniter to auto-load it during system initialization. This is done by opening the application/config/ file and adding the extension to the autoload array.