Read the first command-line argument.

first argument Command-line programs often treat the first argument as the command or action.

First Argument

command
first_argument.lua
Replay: real traced execution (multi-file project)
local command = "build"
local first = ({command, "input.txt"})[1]
local second = ({command, "input.txt"})[2]
print("first=" .. first)
print("second=" .. second)
local command = "test"
local first = ({command, "input.txt"})[1]
local second = ({command, "input.txt"})[2]
print("first=" .. first)
print("second=" .. second)
local command = "deploy"
local first = ({command, "input.txt"})[1]
local second = ({command, "input.txt"})[2]
print("first=" .. first)
print("second=" .. second)
  1. command ← build, first ← build, second ← input.txt

    1local command→ build = "build" --@command="test", "deploy"2local first→ build = ({command, "input.txt"})[1]build3local second→ input.txt = ({command, "input.txt"})[2]input.txt4print("first=" .. firstbuild)5print("second=" .. secondinput.txt)
    outputfirst=build
    second=input.txt
  1. command ← test, first ← test, second ← input.txt

    1local command→ test = "test"2local first→ test = ({command, "input.txt"})[1]test3local second→ input.txt = ({command, "input.txt"})[2]input.txt4print("first=" .. firsttest)5print("second=" .. secondinput.txt)
    outputfirst=test
    second=input.txt
  1. command ← deploy, first ← deploy, second ← input.txt

    1local command→ deploy = "deploy"2local first→ deploy = ({command, "input.txt"})[1]deploy3local second→ input.txt = ({command, "input.txt"})[2]input.txt4print("first=" .. firstdeploy)5print("second=" .. secondinput.txt)
    outputfirst=deploy
    second=input.txt