Jump to content




[error] Printer code


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

#1 HurdeHack

  • Members
  • 27 posts

Posted 22 October 2012 - 04:57 PM

im busy with my own code for an printer im done with the code but while running it it shows an error i cant fix

bios:335: [string "printpagina"]:2: '=' expected

the code
term.clear
term.setCursorPos( 1, 1 )
write("printer zijde kies uit "right" "left" "top" ENZ. - ")
local ZIJDE = read()
printer = peripheral.wrap( ZIJDE )
printer.newPage()
write("welke tekst moet er geprint worden? - ")
local TEKST = read()
printer.write( TEKST )
write("Titel? - ")
local TITEL = read()
printer.setPageTitle( TITEL )
printer.endPage()
textutils.slowPrint("Printen Voltooid")
else
textutils.slowPrint("Printen Mislukt! Check ,inkt ,papier ,code en ga dan door u wordt nu terug gestuurd!")

can someone fix it thank you!

#2 Ditto8353

  • New Members
  • 138 posts

Posted 22 October 2012 - 05:04 PM

write("printer zijde kies uit "right" "left" "top" ENZ. - ")
Fix this line. You cannot have " inside strings like that.
You can use:
write('printer zijde kies uit "right" "left" "top" ENZ. - ')
instead.

This is rather basic for Lua. You may want to take some time to look over the basics in The Manual.

#3 HurdeHack

  • Members
  • 27 posts

Posted 22 October 2012 - 05:08 PM

i still get the same error when i fix that line, i got now
write('printer zijde kies uit right left top ENZ. - ')


#4 Ditto8353

  • New Members
  • 138 posts

Posted 22 October 2012 - 05:11 PM

View PostHurdeHack, on 22 October 2012 - 05:08 PM, said:

i still get the same error when i fix that line, i got now
write('printer zijde kies uit right left top ENZ. - ')
Again I suggest you look over the basics of Lua. You have a single 'else' statement with no If-Then to go with it.

#5 ChunLing

  • Members
  • 2,027 posts

Posted 22 October 2012 - 08:02 PM

the "=" expected error means that you have a reference sitting off by itself, not doing anything, somewhere near the error line. In this case, it's term.clear, because you didn't call it, you just referenced it. But that's probably not the only error in your code.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users