variable(name)

Gets a sequence variable by name. Sequence variables can be of type Location (Plant, Weed, Point, or Tool), Number, Text, or Resource (Sequence, Peripehral, or Sensor).

The Lua command will only be able to access sequence variables that belong to its parent sequence. To access variables from a grandparent, you must pass them into the direct parent sequence by using externally defined variables in the parent sequence.

-- Get the value of the variable named "Location 1"
location = variable("Location 1")

-- Print the location variable's X, Y, and Z coordinates
toast("The location variable is set to: (" .. location.x .. ", " .. location.y .. ", " .. location.z .. ")")