syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
In Lua how to access command line args?

Lua passes command line arguments to me in a 'table' called arg.
-- args.lua
print('first arg is:')
print(arg[1])
print('This script is:')
print(arg[0])
Screen-dump:
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $ lua args.lua hello
first arg is:
hello
This script is:
args.lua
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me