grandMA3 User Manual Publication

Cmd(string[, handle])

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » Cmd(string[, handle])
Version 2.0

Description

The Cmd Lua function executes a command in the grandMA3 command line. It is executed in a Lua task - not the Main task (standard typed commands are run in the Main task). It is executed synchronously, and it blocks the Lua task while executing. This means that a bad command has the potential to block the system.

Alternative functions are CmdIndirect() and CmdIndirectWait().

Argument

  • String:
    A string with the command to be executed in the command line. Do not add a please or enter to execute the command.
  • Handle (optional):
    A handle to an undo (oops) list. Learn more in the CreateUndo topic.

Return

  • String:
    A string is returned with the execution feedback known from the command line feedback
    • OK:
      Command executed.
    • Syntax Error:
      The command was not executed because of a syntax error.
    • Illegal Command:
      Command not executed because of some illegal command or action.

The returned string does not need to be used.

Example

This example executes the two commands "ClearAll" and "Fixture Thru At 0" in the command line.

Lua
return function()
--Execute the command directly
Cmd("ClearAll")
--Execute the command and provide feedback
Printf(Cmd("Fixture Thru At 0"))
end