[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: More complete std.optparse example?
- From: gary@...
- Date: Thu, 28 Apr 2016 07:01:05 +0100
Thanks for your interest in the project!
The content of arg and opts depends on what you wrote in help :-)
You can explore what happens by adding this code:
for k,v in pairs (opts) do print ("opts['" .. tostring(k) .. "']", v) end
for i,v in ipairs (arg) do print ("arg[" .. i .. "]", v) end
And then running your program with various options to see what happens.
You can also see a more complex example in specl, taking help from:
And parsing in process_args() from:
Gary V. Vaughan (gary AT vaughan DOT pe)
On 28 Apr 2016, 02:13 +0100, Dan Christian <email@example.com>, wrote:
I'm trying to use std.optparse for the first time. The example shows
me how to get a parse arg and opt, but I don't know how to test
individual options from there.
local parser = OptionParser (help)
local arg, opts = parser:parse (_G.arg)
What should ... be?