Orientation

All, like an idiot half asleep I added displayMode() before and outside setup() and, not thinking, typed in l for landscape. The three options for Landscape were displayed in the keyword list above the keyboard and I selected LANDSCAPE_ANY, which promptly appeared correctly formatted in the code line. I then proceeded to add further code which involved displaying sprites. Then I ran the project and received a black screen. No sprites. I played around for ages when I realised that LANDSCAPE_ANY was not a valid keyword for displayMode().

I am sure somebody has reported this previously, but I was surprised that the keyword was formatted correctly (colour) and that the code would accept it without error. Are all commands within Codea set up to accept any keyword without checking context and reporting errors? I am embarrassed to tell you that this error took me 10 minutes to find, I thought. I’d made errors in the draw() function since nothing was drawn to the screen.

@Bri_G When I type displayMode() before and outside of setup() and then type an l for landscape inside the brackets of displayMode(), I get STANDARD or FULLSCREEN or OVERLAY. No matter what letter I key in the brackets, I still get STANDARD or FULLSCREEN or OVERLAY.

@dave1707 - just checked it again. Remember I was half asleep when I selected LANDSCAPE_ANY. Type la in the brackets.

@dave1707 - apart from the above, I’ve tried lineCapMode(noise) selected from the keywords - outside setup() just a black screen, inside setup error generated. Similar behaviour from textMode() and a few others. Why does the screen blank when these mistakes are outside setup() ?

@Bri_G I now see what you were talking about way above. When you type a letter in the (), you get a list of all the keywords that begin with that letter just above the keyboard and you choose from that list even though not all are valid for that command. I though when you entered a letter in the (), the list of valid words that popup just above the () was where you got the list. As for the error you get outside and inside setup, that is probably because outside of setup, Codea isn’t doing all the error checking that is probably done when the setup function is executing.

@dave1707 - the list above the text entry doesn’t always seem to pop up. This feature isn’t really an issue it’s only when you make a mistake and are outside the setup() function. I think you are right with the error trapping. Within the functions the data passed to the keyword call is checked for type and that has trapped most of the errors I have seen on this.

Problem is, unless you know about this, you think there is an error elsewhere in your code.

The only way to stop this is to provide all options for the command in the brackets which, on selection of one of them, collapses to that option. There are a few commands with a fixed list of options which could operate in that way, and only a few of them that operate outside any function.

Probably not worth pursuing though, most of us are awake when programming!!!