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

Need help... window:150 string expected got nil

Started by EveryOS, 01 March 2016 - 09:26 PM
EveryOS #1
Posted 01 March 2016 - 10:26 PM
I have a program and it keeps saying there was an error in the window api then shutting down. Any help?
KingofGamesYami #2
Posted 01 March 2016 - 10:38 PM
When the window API errors, you can bet you're passing the term API an invalid value on an advanced computer. Since the only term functions that require a string are term.write and term.blit, I would guess you are passing nil as the first value to one of those two functions. If you want the line number in your program, simply disable the window API by adding

term.redirect( term.native() )
to the top of your program. This will not be a solution if you are using a window.

A typical mistake of extremely new programmers is to forget to create a string.


--#correct:
term.write( "Hello" )
--#incorrect:
term.write( Hello )
Bomb Bloke #3
Posted 01 March 2016 - 11:05 PM
It may also mean you set an invalid colour and then later tried to write with it.
EveryOS #4
Posted 01 March 2016 - 11:56 PM
It may also mean you set an invalid colour and then later tried to write with it.

Doing that would just straight out shut down the computer before it even gets to the write part
HPWebcamAble #5
Posted 02 March 2016 - 12:48 AM
Since the only term functions that require a string are term.write and term.blit, I would guess you are passing nil as the first value to one of those two functions
It may also mean you set an invalid colour and then later tried to write with it.

Actually, since line 150 of the window API has to do with the text color of a line, I'd suspect term.setTextColor()