[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Lua to replace C
- From: Reuben Thomas <rrt@...>
- Date: Fri, 11 Mar 2011 01:31:37 +0000 (UTC)
Richter, Jörg <Joerg.Richter <at> pdv-FS.de> writes:
>
> > I can work around this with an extra
> > level of script, but it means that I can't easily start Zile from a
> > hash-bang script.
>
> I often solve problems like this with a combined lua/sh script:
>
> Like so:
>
> #!/bin/sh
> A=--[[ LUA_INIT= LUA_PATH= LUA_CPATH= exec lua "$0" "$@" # -*- mode: lua; -
*- ]]A
> print( "hello world" )
>
> Note the /bin/sh in the shebang line.
> And with -*- mode: lua; -*- even emacs gets it right.
Nice, thanks for this handy trick. I'd forgotten seeing similar tricks for Perl
in the past.