usage: lua [options] [script [args]]
Available options are:
-e stat execute string 'stat'
-i enter interactive mode after executing 'script'
-l name require library 'name'
-v show version information
-E ignore environment variables
-- stop handling options
- stop handling options and execute stdin
不加任何参数则进入交互式环境.
arg全局变量保存了所有参数, 脚本名索引为0, 脚本参数的索引从1开始, 而脚本之前参数的索引为负数. 比如运行:
$lua -e "print 'hello'" test.lua a b
arg[-3] = lua
arg[-2] = -e
arg[-1] = print 'hello'
arg[0] = test.lua
arg[1] = a
arg[2] = b