Testing the library
Now we have a complete library we want to compile and test it.
To do this we use the LiveCode Extension Builder.
- Open LiveCode
- Open the Extension Builder from the Tools Menu
The Extension Builder
1. Open button – allows you to select and load the extension you wish to build.
2. Data that the builder was able to parse from the directory such as icons, resources, API’s the user guides.
3. Console: Shows status, error and log messages.
4. Test: compiles the extension and loads it into LiveCode
5. Script: Opens the lcb script in an external default editor.
6. Install: Installs the extension into the IDE
7. Uninstall: Uninstalls the extension from the IDE
8. Package: Creates a .lce package which can be shared
Compiling the Hello World Library
Initially we will use the Test button to compile the library and test it without installing.
- Click the Open button and select the “HelloWorldLibrary.lcb” file.
- The Icons, Resources, Deafult Script, API and User Guide sections are automatically populated.
- Click the Test button to compile and load the library in LiveCode.
The log field will give you some show the compilation progress and display any warnings.
The Extension Builder will create a test stack.
LiveCode Builder Extension Files
When the Extension Builder is used to compile a LiveCode Builder file a number of files are created.
- api.lcdoc – LiveCode doc file for the extension. This can be viewed in the LiveCode Dictionary.
- .lci file – LiveCode Interface file. This file contains a list of the public handlers in an extension, and is used when compiling another extension that depends on it to determine whether handlers it calls exist.
- Manifest.xml – An XML manifest file.
- Module.lcm – The compiled module file.
Each module you create will have files with the same names, for example api.lcdoc, which is why we create each extension in a separate directory.
Testing the library in a LiveCode stack
Now the library is loaded we can test it in LiveCode.
- Add button to the test stack.
- Set the code of the button to
on mouseUp answer sayHello() end mouseUp
3. Click the button, you should see an answer dialog displaying the “Hello World!” message returned by the library