[NTLK] Shell arguments in NEWT/0?

Matthias Melcher mm at matthiasm.com
Thu Jan 12 03:39:17 EST 2012


On 12.01.2012, at 04:02, Morgan Aldridge wrote:

> Wow, I totally misunderstood your previous email. Those solutions were
> on the C-side. After more review of the NEWT/0 code, it looks like
> solution #2 is already implemented in NewtInitARGV() in
> src/newt_core/NewtEnv.c. I was able to whip up the following script to
> test and it works:
> 
>    #!/usr/local/bin/newt
> 
>    print("'_ARGV_ exists? ");
>    if GlobalVarExists('_ARGV_) then print("Yes.\n") else print("No.\n");
> 
>    foreach slot, value in GetGlobalVar('_ARGV_) do print(slot && ":"
> && value && "\n");
> 
> So, if I run `./test.ns some test arguments` I get the following output:
> 
>    '_ARGV_ exists? Yes.
>    0 : some
>    1 : test
>    2 : arguments
> 
> Very cool! Thanks for pointing me in the right direction!

Great! I did not see that, but I am not too surprised that this was actually already implemented.


More information about the NewtonTalk mailing list