[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Using luac
- From: Francisco Olarte <folarte@...>
- Date: Sat, 28 May 2022 19:35:42 +0200
On Sat, 28 May 2022 at 03:07, Duke Normandin <email@example.com> wrote:
> Thx! The example I was following had the -o option dead last.
Are you sure you copied right AND your example source has the examples tested?
I've just checked luac.c and it uses its own arg parsing function,
similar to the standard *ix getopt ones, and it expect all options
before all arguments. Of course you can play shell tricks to get
something similar, but not extrictly dead last:
folarte@7of9:~/tmp$ echo return 1 > ret1.lua
folarte@7of9:~/tmp$ luac < ret1.lua -o ret1.out -
folarte@7of9:~/tmp$ od -tx1 ret1.out | head -n 1
0000000 1b 4c 75 61 53 00 19 93 0d 0a 1a 0a 04 08 04 08
But it needs the extra - and knowing redirections can be placed
anywhere in the command line, which is not normally used that way, and
doing a pointless redirection just to show off.
( many getopt and friends can reorder arguments, but doargs in luac does not ).