←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

Trying to reference another file/program a...

Nhorr's Photo Nhorr 27 Jul 2016

Back again with yet another problem I can't make sense of. I understand the error refers to the program not being able to reference the target due to it not existing, but as far as I can understand, it should be able to reference the target without a problem.

My desktop code is supposed to reference a file named .nhuicfg for color settings/etc, creating a table based off of the contents of .nhuicfg for desktop to reference (based on a similar forum post). Thing is, when the supposed table is first called up for a value, it returns an index nil error at line 62. Perhaps the table containing .nhuicfg's values isn't constructing at all? I can't get it to work, but then again I never understood tables quite well (I need to get more practice in with them)

The desktop portion of my UI can be seen here: http://pastebin.com/JUhsDLDd
The .nhuicfg file it references can be seen here: http://pastebin.com/mbD7EU2J
Lastly, the UI installation program can be found here: http://pastebin.com/qExuNAUg

I haven't had much time to search the issue as of late, but I haven't been able to find much on this particular issue. Any point in the right direction would be much appreciated.

Many thanks in advance!
Edited by Nhorr, 27 July 2016 - 10:00 PM.
Quote

KingofGamesYami's Photo KingofGamesYami 27 Jul 2016

The .nhuicfg file doesn't contain a serialized table, therefor unserialize returned nil.

Also, correct me if I'm wrong since I haven't used io much, but doesn't file:read() only return one line of the file?
Edited by KingofGamesYami, 27 July 2016 - 10:21 PM.
Quote

The_Cat's Photo The_Cat 28 Jul 2016

View PostKingofGamesYami, on 27 July 2016 - 10:17 PM, said:

The .nhuicfg file doesn't contain a serialized table, therefor unserialize returned nil.
Not related to OP. But in the serialized wiki, the first code example has an error. (Unsure how/if I can edit it.)
Edited by The_Cat, 28 July 2016 - 09:32 AM.
Quote

Lupus590's Photo Lupus590 28 Jul 2016

View PostThe_Cat, on 28 July 2016 - 09:32 AM, said:

View PostKingofGamesYami, on 27 July 2016 - 10:17 PM, said:

The .nhuicfg file doesn't contain a serialized table, therefor unserialize returned nil.
Not related to OP. But in the serialized wiki, the first code example has an error. (Unsure how/if I can edit it.)

I think I fixed it, it was also in the second example
Quote

Nhorr's Photo Nhorr 29 Jul 2016

View PostKingofGamesYami, on 27 July 2016 - 10:17 PM, said:

The .nhuicfg file doesn't contain a serialized table, therefor unserialize returned nil.

Also, correct me if I'm wrong since I haven't used io much, but doesn't file:read() only return one line of the file?

Thanks for the reply (only just now got around to checking for replies on this). I'll get around to making it contain a serialized table and test things out in the next few days. I'll be back with the results when I do. Again, thanks for the insight!

And sadly I haven't used it enough to know the exact answer, but I guess we'll find out soon enough when I try to test things out.
Quote