This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dayrider10's profile picture

Trouble With Using Another File's Content

Started by Dayrider10, 23 April 2014 - 11:56 PM
Dayrider10 #1
Posted 24 April 2014 - 01:56 AM
Hey Everyone!

The title may be confusing ,but here is my problem and all. I want it so that I can open the file called "player.info" and use the contents and put them in a table that have which is tankInfo. What happens is that when it goes to draw the tank it reports back an expected number error. For example if I assigned the color in the tankInfo table to playercolor which is in the file we opened it says an expected number. Yes I have tried tonumber. Here is the pastebin code;

Here is the main code:

http://pastebin.com/3cVTthJh

Here is the contents of the file:

http://pastebin.com/WFzXi43K

From lines 90 - 97 opens the player.info file. From lines 115 - 123 is the table with the tank and in the player.info file (the second link) it is from lines 3 - 8.

Thanks!
Live On!
Lyqyd #2
Posted 24 April 2014 - 02:14 AM
You should store just the color name, then use colors[handle.readLine()] to get the number.
Dayrider10 #3
Posted 24 April 2014 - 12:36 PM
Thanks Lyqyd! It worked like a charm!