Jump to content




Code Not Working and I Can't See What's Wrong


  • You cannot reply to this topic
3 replies to this topic

#1 zaxinvex

  • Members
  • 5 posts

Posted 04 October 2015 - 12:31 PM

So I was making an OS (And still am, I am NOT cancelling this) and I ran into some errors with the menu. It kept saying: bios:14: [string ".temp":15: '<eof>' expected. I don't know what this means or how to fix it. Here is my code:
local ch1 = read()
if ch1 == 1 then
shell.run("programs")
elseif ch == 2 then
shell.run(".sor")
elseif ch == 3 then
shell.run(".hai")
elseif ch == 4 then
shell.run("news")
end

CAN SOMEONE DECODE THIS? And also tell me any other mistakes I've made... Also, in front of the shell.runs in the actual code I have used the tab button.

#2 valithor

  • Members
  • 1,053 posts

Posted 04 October 2015 - 07:04 PM

Could you post all of your code? The error you provided points to line 15, and the code you posted here is definitely not 15 lines. If you type the code into the post by hand, then make sure that you are copying it exactly how it is. Otherwise just provide a pastebin link.

If I remember correctly that error means you have too many ends in your code.

Edited by valithor, 04 October 2015 - 07:05 PM.


#3 KingofGamesYami

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

Posted 04 October 2015 - 07:11 PM

The code you posted will not throw that error, however it will not work either.

Problem: you get the variable "ch1" from the user, and thereafter refer to the variable "ch" - which is nil because it was never defined.

Problem: read returns a string, which you are comparing against a number. This should help you understand:

print( 1 == "1" )
print( tostring( 1 ) == "1" )
print( 1 == tonumber( "1" ) )


#4 zaxinvex

  • Members
  • 5 posts

Posted 17 October 2015 - 01:30 AM

Oh thanks.

By the way about that OS, I'm not cancelling it, just making a new format. So this choice business is not used anymore.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users