lua 命令行参数
--test.lua if arg[1] == '1' then print("Hello World!") elseif arg[1] == '2' then print("Hi, Captain!") else print("Hi, Tom") end
root@test# lua test.lua 1 Hello World! root@test# lua test.lua 2 Hi, Captain!
遍历参数:
--test.lua for i, v in pairs(arg) do print(i, v) end