interactive lua: command line arguments

You’re missing the arg vector, which has the elements you want in arg[1], arg[2], and so on:

% lua -i -- /dev/null one two three
Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> print(arg[2])
two
> 

More info in the Lua manual section on Lua standalone (thanks Miles!).

Leave a Comment