Hello all,
I'm actually working on a big project (600 lines), and I have an error I don't understand.
ERROR: At line 538 permgCmd[ucmdLoop] is nil and I don't know why :/ .
Pastebins:
Program: http://pastebin.com/NqW3aySf
Externals files (placed in same directory)
test.txt: http://pastebin.com/4mFPDBLX
base.permg: http://pastebin.com/42AuTsB9
Additional info:
In read() line 204: test.txt
In read() line 233: base.permg
NOTE: Never tested in-game, using CC Emulator
Thanks.
(Sorry for my bad english)
7 replies to this topic
#1
Posted 23 June 2013 - 07:56 AM
#2
Posted 23 June 2013 - 08:00 AM
What line is the error popping up on?>
#3
Posted 23 June 2013 - 08:04 AM
Quote
What line is the error popping up on?>
Oops, I missed one line in the post.
Edited.
#4
Posted 23 June 2013 - 08:19 AM
The pastebin doesn't seem accurate seeing as line 560 there's a print("564") and on what would be 561 based on that (or 561 in the pastebin) doesn't have any reference to permgCmd.
#5
Posted 23 June 2013 - 08:26 AM
Modified. It's now line 538.
#6
Posted 23 June 2013 - 09:12 AM
Line 546:
The way I read it, that should be a "ucmdLoop == #permgCmd" there.
A "for" loop would be neater than "repeat...until":
And that's assuming you don't want to rebuild the table so's the key names match the commands you want to check, which'd allow you to skip the loop completely. To do it, you'd replace line 309 with:
"permgCmd[command]" will then be "true" if "command" exists in that table.
until ucmdLoop > #permgCmd + 1 or quitsc == true
The way I read it, that should be a "ucmdLoop == #permgCmd" there.
A "for" loop would be neater than "repeat...until":
for ucmdLoop=1,#permgCmd do
sleep(0.1) -- Only required if you're running a biiiiiig loop here.
if permgCmd[ucmdLoop] == command then
print (command.." founded in ID "..ucmdLoop.. ".")
sleep(1)
toreturn = ucmdLoop
break
end
end
And that's assuming you don't want to rebuild the table so's the key names match the commands you want to check, which'd allow you to skip the loop completely. To do it, you'd replace line 309 with:
permgCmd[line] = true
"permgCmd[command]" will then be "true" if "command" exists in that table.
#7
Posted 23 June 2013 - 09:58 AM
Okay, but this don't have any link to this error?
Or I don't have understand.
EDIT: Okay, i have understand. Your But I still want to use index tables (entry1= "fff", 2= "rrr", 3= "ggg"...) instead of "variables tables" ("/com", "/set"...) / ("/com" = true, "/set" = true).
The thing I want to know is why at line 309 I fill up the table permgCmd and at line 538 permgCmd[1] is nil.
Or I don't have understand.
EDIT: Okay, i have understand. Your But I still want to use index tables (entry1= "fff", 2= "rrr", 3= "ggg"...) instead of "variables tables" ("/com", "/set"...) / ("/com" = true, "/set" = true).
The thing I want to know is why at line 309 I fill up the table permgCmd and at line 538 permgCmd[1] is nil.
#8
Posted 23 June 2013 - 05:23 PM
permgCmd[ucmdLoop] would eventually be nil because you allowed ucmdLoop to get all the way up to #permgCmd+2.
If permgCmd[1] is nil then you've got more serious problems in addition to that.
Reading a bit further, I see the function that fills the table for you - readPermg() - is only called by that same function. Meaning it'll never execute. Not only that, but you appear to've put that function inside the processingPart() function, which should've been ended by the time you start defining the next one.
If permgCmd[1] is nil then you've got more serious problems in addition to that.
Reading a bit further, I see the function that fills the table for you - readPermg() - is only called by that same function. Meaning it'll never execute. Not only that, but you appear to've put that function inside the processingPart() function, which should've been ended by the time you start defining the next one.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











