This topic contains 0 replies, has 1 voice, and was last updated by  russell.stitt 8 years, 2 months ago.

How to Retrieve Resource Files

  • I recently needed to retrieve a vmd file that I had included as part of the project. It was added into ‘other’ as is usual, but I could not find an obvious way to open the file.

    Interestingly, utilities such as hl7.parse{vmd=,data=} and chm.parse{vmd=,data=} both accept the name of the schema file without a full path, but how to resolve that path myself?

    The resolved path is available in iguana.project.files() which changes depending on whether Iguana is in test or run mode. Here is some sample code that may help someone else:

    local function readAll(path)
        local f =, "r")
        if f==nil then return nil end
        local content = f:read("*all")
        return content
    -- The main function is the first function called from Iguana.
    function main()
       local relPath = iguana.project.files()["other/a_test_message.txt"]
       local absPath = iguana.workingDir()..relPath;
       local message = readAll(absPath)
       if iguana.isTest() then
          message = message.." [In Test/Edit Mode]"
          message = message.." [In Prod/Run Mode]"
    You must be logged in to view attached files.

You must be logged in to reply to this topic.