> When executing lua with the script and extra arguments;
> 
> > C:\Users\Thijs\Dropbox\Lua projects\rocks_wrap_test>lua wraptest.lua
> hello
> > world
> > 1       hello
> > 2       world
> > -1      lua
> > 0       wraptest.lua
> > found   4       arguments
> 
> This is the expected result.
> When doing it directly using the generated wrapper;
> 
> > C:\Users\Thijs\Dropbox\Lua projects\rocks_wrap_test>wraptest hello world
> > found   0       arguments
> 
> All arguments are gone...

Found the cause, the wrapper is loading the commandline args as extra arguments 
in a pcall to the chunk being loaded. Sounds cryptic, but changing this line;

> for k,v in pairs(arg) do

Into

> for k,v in pairs({...}) do

Made the commandline arguments appear. The wrapper code loading the args and 
doing the pcall is here; 
https://github.com/keplerproject/luarocks/blob/master/src/bin/rclauncher.c#L47 

But this doesn't fix the problem as commandline scripts expect the 'arg' table.

@steve; does ldoc (or probably penlight) require the arg entries 0 and -1 
(respectively scriptname and executable name)? or is 1 and up enough?

Thijs

PS. Did this ever work?

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to