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

[error] Printer code

Started by HurdeHack, 22 October 2012 - 03:57 PM
HurdeHack #1
Posted 22 October 2012 - 05: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!
Ditto8353 #2
Posted 22 October 2012 - 06: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.
HurdeHack #3
Posted 22 October 2012 - 06: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. - ')
Ditto8353 #4
Posted 22 October 2012 - 06:11 PM
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.
ChunLing #5
Posted 22 October 2012 - 09: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.