Project Files

Project Manager

The Project Manager panel is used to manage the local and shared files in your project.

The Project Manager consists of three sections:

  1. Local dependencies: Lists local modules and files used by your script.
  2. Shared modules: Lists Lua modules used by your script.
  3. Other files: Lists non-Lua shared files used by your script.

If the Project Manager panel is hidden, click Show Project Manager:

Shared Modules [top]

Shared Lua modules are can be used by any script in the same Iguana instance. Shared modules are stored in the “shared” directory in Iguana’s working directory (<working dir>\edit\<iguana user>\shared).

What are shared modules for? The primary purpose is to share code between channels on a server — so you can ensure (or enforce) consistent behaviour across multiple channels. This makes it easy to apply business logic consistently across multiple channels — by encapsulating the rules in a shared module. Shared modules are also very useful for sharing library/utility code. To share modules across multiple Iguana Servers you will need to export the code to a remote Git repository and then import it to the other servers. Any behaviour that is specific to a single channel should be implemented using local module files (which you can easily promote to shared modules later if required).

Note: Because shared modules are version controlled you can use different commits for different channels. We strongly recommend against this for two reasons: It loses the benefits of consistent behaviour across multiple channels, and it also makes managing code much more difficult as you need to track the correct commit/version for each channel.

To add a shared module to your project:

  1. In the Project Manager panel, click the [+] link that is located next to the shared folder or a sub-folder:
  2. Then choose to Add, Create or Upload a file from the dialog box:
  3. You can also create a sub-folder to contain a module:
    • When you Create a new file include the path in the name:
    • When you Upload a file add the path in the new folder field:

Tip: You can also add an existing module to your script by adding a require'<existing-module>' function call.

For example, this code will add stringutil.lua to the shared folder in the Project Manager panel:

Be aware that require() does not create new modules, it will only add existing modules. If you try to add a new module you will get an error.

Using Modules in Scripts

To include a module in your script, use a require function call.

There are several variations for require:

  1. For example, if we add require 'test' then we can use the foo() and bar() functions:


    Note: If we we comment out the require statement then we get an error:
  2. To access a module in a sub-folder we need to use a dot “.” syntax to separate the sub-folders:
  3. If you have local and shared modules the local module takes priority:

    Note: This is great for testing changes before moving them to a shared module.
  4. You can “change” the name of the module return by assigning it to a variable:

Editing Modules

To view and edit the code in a module, in the shared folder, click on the name of the module.

For example, if you click on stringutil the module code is displayed:

Removing a module

To remove a module, position the cursor over the arrow next to the module name, and click Remove in the menu that appears:

Note: Removing a module does not delete the it from your system.

Other menu options

Three other menu options are available:

  • Get: Export the file
  • Replace: Import and replace the existing file
  • Change History: View Commit History for the file

Other Shared Files [top]

Other shared files can also be used by any script in the same Iguana instance. Other shared files are stored in the “other” directory in Iguana’s working directory (<working dir>\edit\<iguana user>\other).

Adding Files

To add a shared file to your project:

  1. In the Project Manager panel, click the [+] link that is located next to the other folder or a sub-folder:
  2. Then choose to Add, Create or Upload a file from the dialog box:
  3. You can also create a sub-folder to contain a file:
    • When you Create a new file include the path in the name:
    • When you Upload a file add the path in the new folder field:

Note: This is most commonly used for adding VMD files, used by hl7.parse{} to parse HL7 messages. You can also add other files like: gif, png, js, css etc.

Edit a File

To view or edit file text, in the other folder, click on the name of the file. Iguana can edit any text based file (like css, js, html, etc.), however it cannot edit binary files (like exe, png, gif, etc.).

For example, a javascript file might look something like this:

Removing Files

To remove a file, position the cursor over the arrow next to the file name, and click Remove in the menu that appears:

Note: Removing a file does not delete the it from your system.

Other menu options

Three other menu options are available:

  • Get: Export the file
  • Replace: Import and replace the existing file
  • Change History: View Commit History for the file

Tip: Try exporting a VMD file and opening it with Chameleon, this is useful if you want to examine or update a VMD file that your script is using.

Local Modules and Files [top]

Local modules and files can only used by the script they are created in (they are not shared with other components). Local files can be any type of file (Lua modules or other files). Local files are stored in the component directory for your channel in Iguana’s working directory (<working dir>\edit\<iguana user>\<generated name for channel+component>).

Local modules take precedence over shared files of the same name. This is great for prototyping and testing as you can try out changes in a single channel without affecting other channels using the shared file (of the same name). Then once you have the changes working correctly you can add the them to the shared file. It is also useful if you need to customize the behaviour of a single channel so it behaves differently from the (default behaviour) of the shared module.

Note: Local modules are just local Lua files with a “.lua” extension like “MyLocalModule.lua”.

Tip: Local files are really good for sandboxing, this is where you make a local copy of a shared file and use it to test changes, without affecting other channels.

It is also the best place for files that are specific to the project and should not be shared with other channels, for example functions implementing business logic specific to the channel, VMD (or DBS) files that are specific to the channel, etc.

Adding Files

To add a file to your project:

  1. In the Project Manager panel, click the [+] link that is located at the top next to the Project Name:
  2. Then choose to Create or Upload a file from the dialog box:
  3. You can also create a sub-folder to contain a local file or module:
    • When you Create a new file include the path in the name:
    • When you Upload a file add the path in the new folder field:

Edit a File

To view or edit a local module or text file text, click on the name of the file. Iguana can edit any text based file (like css, js, html, etc.), however it cannot edit binary files (like exe, png, gif, etc.).

For example, a local stringutil.lua with test code might look something like this:

Removing Files

To remove a file, position the cursor over the arrow next to the file name, and click Remove in the menu that appears:

Note: Removing a file does not delete the it from your system.

Other menu options

Three other menu options are available:

  • Get: Export the file
  • Replace: Import and replace the existing file
  • Change History: View Commit History for the file