GamerNebulae, on 31 May 2014 - 08:05 PM, said:
As I tried to clarify above your post, lol. What I and Dog are trying to say is this.
--If you typed this in your Computer:
<program title=""> variable1 variable2
In your program, variable1 is args[1] and variable2 is args[2]. If you are not planning to add more commands, then you should change the code so it checks if args[1] is "add-repo" or "oldconfig". Something like this:
if args[1] == "oldconfig" then
sCommand = args[1]
<actions>
elseif args[1] == "add-repo" then
sCommand = args[1]
<actions>
end
That's not what I was trying to say. Allow me to clarify a bit...
Your clarification (second post) mentions args[2], but it doesn't really address or explain the nil value of args[2]. My question was whether IsaacTBeast is even passing a second argument to the program. Currently the program only checks to see if the first argument was passed, but is complaining that the second argument is nil. There's no sanity check for the second argument, so if one is never provided it will be nil from the get-go.
Looking at the code, I can only see one reason why args[2] would be nil (thus causing the error IsaacTBeast is encountering): The second argument isn't being passed to the program.
No amount of tinkering with args[1] is going to fix that.
My theory can easily be verified by changing line 27 from
if #args < 1 then
to
if #args < 2 then
If the second argument isn't being passed, the usage screen will be displayed instead of the program continuing.
IsaacTBeast - would you please post the exact command you are using to launch the program and (for good measure) verify that the file actually exists on Github.
Edited by Dog, 31 May 2014 - 09:23 PM.