Jump to content




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


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

#1 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

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?

#2 KingofGamesYami

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

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 )


#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 01 March 2016 - 11:05 PM

It may also mean you set an invalid colour and then later tried to write with it.

#4 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 01 March 2016 - 11:56 PM

Quote

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

#5 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 02 March 2016 - 12:48 AM

View PostKingofGamesYami, on 01 March 2016 - 10:38 PM, said:

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

View PostBomb Bloke, on 01 March 2016 - 11:05 PM, said:

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()





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users