LUA script help with variable source static destination

  • I have some LUA script that I have and am not quite sure how to get working properly in the MA3, any help would be great!!

    local destinationMA_TRICKNumber = 102 -- (Predefined static destination)

    function GetUserInputForSource()

    local userInput = Input("Enter source MA-TRICK number:", "")

    local sourceNumber = tonumber(userInput)

    if sourceNumber then

    return sourceNumber


    Echo("Invalid input. Please enter a numeric value.")

    return nil



    function CopyMATRICK(source, destination)

    if source then

    -- Construct the command string to copy the MA-TRICK item

    local commandString = string.format("Copy MA-TRICK %d At MA-TRICK %d", source, destination)

    -- Execute the command


    Echo(string.format("MA-TRICK %d copied to MA-TRICK %d successfully.", source, destination))


    Echo("Copy operation aborted due to invalid source.")



    local sourceMATRICKNumber = GetUserInputForSource() -- Dynamic source input from user

    CopyMATRICK(sourceMA_TRICKNumber, destinationMA_TRICKNumber) -- Execute copy with dynamic source and static destination

    • the script must (at the end) return the section of the code that should run each time plugin is called, as a function :
    local mystatictext = "Hello World"
    return function()
    • functions called by the script must exist, e.g. Input() doesn't exist, - however TextInput() does
    • any commandline must contain valid syntax, e.g. MA-TRICK is not a valid keyword, - however MAtricks is
    • variables must be spelled the same way every time, e.g. sourceMATRICKNumber versus sourceMA_TRICKNumber
    • commandline syntax that may trigger UI-dialogs must be executed via CmdIndirectWait(), not via Cmd()
    • to avoid conflict with other plugins, variables and functions should be defined as local, e.g.
      local function CopyMATRICK(source, destination) --[[code]]-- end

    in case you didn't know, the following single commandline syntax does practically the same as your script:

    Copy MAtricks (source MA-TRICK number:) At 102 /Overwrite

  • Awesome, thank you so much!! would that be easily modified to give a menu with a list of options? Basically I would like to create a single button on a layout view to swap MAtricks between some source locations to a master recipe reference.

  • you would need to use a Lua script to create option-lists:

    PopupInput - grandMA3 User Manual - Help pages of MA Lighting International GmbH

    If you want to avoid fiddling with Lua, and visually can accept the optionlist to look like a Goto-dialog:

    • create an empty sequence with one cue for each option, and put the desired commandline-syntax in each of the cue-commands
    • assign sequence to your Layout with Goto as action

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!