grandMA3 User Manual Publication
Export(handle, string, string)

grandMA3 User Manual » Plugins » Lua Functions - Object API » Export(handle, string, string)
Version 2.1

Description

The Export object Lua function exports an object into an XML file.

Arguments

  • Handle:
    The function takes a handle of the type "light_userdata" as an argument.
    It can be omitted when using the colon notation on an object.

    The Colon Notation is a way to omit the handle as the first argument when using the Object functions.

    This is the general syntax with the colon notation: object:function()

    This is the general syntax with standard handle notation: object.function(object)

    Learn more in the Lua Functions - Object API topic.

  • String:
    This is a string with the file path for the exported file.
  • String:
    This is a string containing the file name of the exported file.

Return

  • Boolean:
    The function returns a boolean indicating if the export was a success.

Examples

This example exports the selected sequence into an XML file:

Lua
return function()
--SelectedSequence() creates a handle to the selected sequence.
local selectedSequence = SelectedSequence()
if selectedSequence == nil then
ErrPrintf("The selected sequence could not be found.")
return
end
--The path is stored in a variable.
local exportPath = GetPath(Enums.PathType.UserSequences)
--The actual export function.
local success = selectedSequence:Export(exportPath, "mySelectedSequence.xml")
--Print some feedback.
if success then
Printf("The sequence is exported to: " .. exportPath)
else
ErrPrintf("The sequence could not be exported.")
end
end

 Related Object Functions

Import - object function used to import an XML table.