index expected, instead got nil
#1
Posted 17 January 2016 - 11:15 PM
Here is the pastebin for the program and Here is the plugin its trying to load. I also have a couple of screenshots Here (the reason why it says 137 in the screenshot is because of the 2 prints i have added before it).
#2
Posted 18 January 2016 - 12:04 AM
Line 135:
_G[tabName][key]
_G clearly isn't nil.
_G[ tabName ] could very well be nil. I would consider using a print on this, to check when it's nil and why.
#3
Posted 18 January 2016 - 12:20 AM
KingofGamesYami, on 18 January 2016 - 12:04 AM, said:
Line 135:
_G[tabName][key]
_G clearly isn't nil.
_G[ tabName ] could very well be nil. I would consider using a print on this, to check when it's nil and why.
did you see the imgur link to the ingame screenshots i posted aswell? i've printed mergeTab, tabName, key and value and they all are what they should be
#4
Posted 18 January 2016 - 12:36 AM
if _G[tabName] then _G[tabName][key] = value else print("Aww shucks, it's nil") end
Edited by Dragon53535, 18 January 2016 - 12:38 AM.
#5
Posted 18 January 2016 - 06:51 AM
#6
Posted 18 January 2016 - 08:59 AM
Dragon53535, on 18 January 2016 - 12:36 AM, said:
if _G[tabName] then _G[tabName][key] = value else print("Aww shucks, it's nil") end
just tried that and its always going to the else statement and not the code in the if.
Bomb Bloke, on 18 January 2016 - 06:51 AM, said:
well its saying the line after so if it means the line before then yes but wouldn't that error/nil when i tried to print it?
#7
Posted 18 January 2016 - 09:09 AM
Defining them as global tables (as you do around line 38) doesn't achieve that, at least, not within ComputerCraft. Each system has a global environment table that's separate to _G. If you want to stick something in _G, specify that that's where you want it to go.
Which brings up the question, why would you want to stick it them _G? Why not just make them subtables of something local to your script?
#8
Posted 18 January 2016 - 09:15 AM
Bomb Bloke, on 18 January 2016 - 09:09 AM, said:
Defining them as global tables (as you do around line 38) doesn't achieve that, at least, not within ComputerCraft. Each system has a global environment table that's separate to _G. If you want to stick something in _G, specify that that's where you want it to go.
Which brings up the question, why would you want to stick it them _G? Why not just make them subtables of something local to your script?
How would i specify thats where i want it to go? and im not sure what you mean by that last bit
Edited by eniallator, 18 January 2016 - 09:50 AM.
#9
Posted 18 January 2016 - 11:35 AM
eniallator, on 18 January 2016 - 09:15 AM, said:
Instead of:
status = {upload = 1, download = 1, filelist = 1, redstone = 1}
... you'd do:
_G.status = {upload = 1, download = 1, filelist = 1, redstone = 1}
eniallator, on 18 January 2016 - 09:15 AM, said:
local myTable = {} myTable.status = {upload = 1, download = 1, filelist = 1, redstone = 1}
#10
Posted 18 January 2016 - 09:11 PM
Bomb Bloke, on 18 January 2016 - 11:35 AM, said:
eniallator, on 18 January 2016 - 09:15 AM, said:
Instead of:
status = {upload = 1, download = 1, filelist = 1, redstone = 1}
... you'd do:
_G.status = {upload = 1, download = 1, filelist = 1, redstone = 1}
eniallator, on 18 January 2016 - 09:15 AM, said:
local myTable = {} myTable.status = {upload = 1, download = 1, filelist = 1, redstone = 1}
i made another solution for the problem and Here is the result of it, Thank you so much for the help though, i don't think i was even close to finding the solution
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users