grandMA3 User Manual Publication

Import(string)

Description

The object-free Import Lua function imports a Lua table in XML format.

This function correlates to the Export function.

Arguments

  • String:
    This is a string containing the file name of the desired imported file. It should contain the file name, including the entire path. See the example below.

Return

  • Table:
    This is the imported table.

Example

This example imports the table exported using the example in the Export() function topic - please run that example before running this example.

Lua
return function ()
-- Get the path for the exported table.
local importPath = GetPath(Enums.PathType.Library) .. "/BuildDetails.xml"
-- Check if the file exist and print relevant feedback.
if importPath == nil then
-- File does not exist.
ErrPrintf("The desired file does not exist. Please add it or adjust the requested file name.")
else
-- Import the table.
local importedTable = Import(importPath)
-- Check if the import returned something and print relevant feedback.
if importedTable == nil then
-- Import didn't return anything.
ErrPrintf("The import failed.")
else
-- Print some of the table content.
Printf("CompileDate: " .. importedTable.CompileDate)
Printf("CompileTime: " .. importedTable.CompileTime)
Printf("BigVersion: " .. importedTable.BigVersion)
Printf("HostType: " .. importedTable.HostType)
Printf("HostSubType: " .. importedTable.HostSubType)
Printf("CodeType: " .. importedTable.CodeType)
end
end
end