lua-users home
lua-l archive

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


On Fri, Apr 30, 2010 at 9:16 AM, James Graves <ansible@xnet.com> wrote:
> On Unix, typically you write your Lua script like so and make it executable:
>
> -- ltest
> #!/usr/local/bin/lua
> print('I am '..arg[0])
>
> And you get exactly what you need from arg[0]
>
> ~$ ltest
> I am /home/sdonovan/bin/ltest

I promote the use of this for Unix shell script invocation:

   #!/usr/bin/env lua
   print('I am '..arg[0])

This way, it will find whichever lua is first in your execution path,
and run that.  Other people running your script, which may have their
own version of Lua, will be using theirs instead.  And people who
don't have their own copy of Lua will use the system one at
/usr/bin/lua .

I completely agree. This is the way I run all mine. Seems much easier in terms of portability.
--
Regards,
Ryan