lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I'd like to use lua in a "Run Shell Script" action of Automator, the
OS X GUI to build workflows.
Automator passes the actual script to the interpreter as a single
options containing newlines eventually prefixed by a flag specified in
a XML file, I used '-e' in the case of Lua, and it let the user choose
either to pass input on stdin or as arguments.

As of version 5.1.4 Lua accepts argument on the invoking line only if
there's a script filename, that is a line like:
    lua -e 'print(type(arg))' foo.lua bar baz

will print out 'nil' even if an empty foo.lua script exists, this way
arguments to the Automator "Run Shell Script" action can't be passed
as arguments

I'm using a this line as starter:
    arg=arg or {} for line in io.lines() do table.insert(arg,line) end

but I was wondering if I was missing something obvious, is there a way
to pass arguments to commands run with -e option?