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

table code

Started by CanadaSoldier, 18 November 2014 - 10:18 AM
CanadaSoldier #1
Posted 18 November 2014 - 11:18 AM
Hellow everybody (:

i created a code, and i have a problem,

The Pastebin of the code is: CPnrxVkw

my probelm is, when i check with the input text equlas to a text in the table,
i typed the correct string in the table and its still saying to me that its wrong.
but, if i type the 1st text in the table, its working.
Please help me.
CanadaSoldier #2
Posted 18 November 2014 - 02:03 PM
please someone ?
CoderPuppy #3
Posted 18 November 2014 - 02:17 PM
Remove the break on line 20 (in the else)
It's making it only check the first element of the table
CanadaSoldier #4
Posted 18 November 2014 - 02:40 PM
Remove the break on line 20 (in the else)
It's making it only check the first element of the table

Thank you,
its work, but no so good.
if i type a text thats not in the table, its showing me alot of error message:
http://imageshack.com/a/img673/4884/nQqvTn.png

and if i enter 175 its showing me properly:
http://imagizer.imageshack.us/a/img673/6199/cjkkhb.png

but. if i enter a text that in the table that is not 175, its working but not good:
http://imagizer.imageshack.us/a/img901/8234/mBpLNI.png

please help me.
CoderPuppy #5
Posted 18 November 2014 - 04:04 PM
The way I would fix that it to add a matched variable (default it to false) and set it to true in the if.
Then at the end (after the loop) check if it's false and then (and only then) print the error message.

Also setting sCode to table on line 15 isn't necessary.