Posted 12 May 2013 - 01:41 AM
I'm trying to make use of Pruby's dome and sphere program.
However - the latest version (which was a quick one I gather) has a flaw and while I have figured out where it is, I can't figure out how best to solve it.
The program in full is at http://pastebin.com/SUJsjAqi
The problem is (I think) the handling of the command line arguments. I include the relevant code below
(Please note - the above code is NOT the complete program … it's just a chunk I lifted out).
When attempting to run the program with the command line
sdbuild 24 -sz 24
the result is:
Unrecognized argument: 24Usage: sdbuild <radius> [-c] [-sz<start layer>] [-ez <end layer>]sdbuild:218: attempt to call nil
My reading of the code makes me think that it has no means by which to handle the numeric values.
Is this correct and if so, how can I correct the problem.
Thanks
However - the latest version (which was a quick one I gather) has a flaw and while I have figured out where it is, I can't figure out how best to solve it.
The program in full is at http://pastebin.com/SUJsjAqi
The problem is (I think) the handling of the command line arguments. I include the relevant code below
for argn=2,#arg do
if arg[argn] == "-c" then
cost_only = true
elseif arg[argn] == "-sz" then
zstart = tonumber(arg[argn + 1]) - 1
argn = argn + 1
elseif arg[argn] == "-ez" then
zend = tonumber(arg[argn + 1]) - 1
argn = argn + 1
else
print("Unrecognised argument: " .. arg[argn])
print("Usage: sdbuild <radius> [-c] [-sz <start layer>] [-ez <end layer>]")
os.exit(1)
end
end
(Please note - the above code is NOT the complete program … it's just a chunk I lifted out).
When attempting to run the program with the command line
sdbuild 24 -sz 24
the result is:
Unrecognized argument: 24Usage: sdbuild <radius> [-c] [-sz<start layer>] [-ez <end layer>]sdbuild:218: attempt to call nil
My reading of the code makes me think that it has no means by which to handle the numeric values.
Is this correct and if so, how can I correct the problem.
Thanks