Jump to content




Trying to reference another file/program as a table, getting "attempt to index ?" error.

api lua help

4 replies to this topic

#1 Nhorr

  • Members
  • 45 posts
  • LocationSomewhere in Eastern USA.

Posted 27 July 2016 - 09:59 PM

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.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 27 July 2016 - 10:17 PM

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.


#3 The_Cat

  • Members
  • 119 posts

Posted 28 July 2016 - 09:32 AM

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.


#4 Lupus590

  • Members
  • 1,965 posts
  • LocationUK

Posted 28 July 2016 - 02:58 PM

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

#5 Nhorr

  • Members
  • 45 posts
  • LocationSomewhere in Eastern USA.

Posted 29 July 2016 - 08:44 PM

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users