Let me step back for a second and explain how Corona detects errors.
In computer programming there are two ways to turn code into something the computer can run. One is to use a Compiler. Languages like C, Pascal, FORTRAN are compiled languages. That is, you write all your code and then run the compiler program and it goes through all the code and spits out every error in can find. You could have dozens or hundreds of errors printed out to the screen. You then go fix them, run the compiler again, fix the errors until it's error free.
Corona SDK on the other hand, since it's using Lua is what's known as an interpreted language. Your code is converted to something machine runnable on the fly. So every time you tell Corona to relaunch your app in the simulator, it converts the code.... Typically interpreted languages stop when they hit an error. since they can't go on trying to run a buggy program.
In your case, you may have more errors than the one it's stopping on. You won't know until you fix that error and try again. I suspect you will have another error on that one line. Since screenW is nil, I expect that screenH will also be nil.
Looking just at leve1.lua, if you did not define screenW and screenH, did you also define _W and _H? Your phone number in your SMS sender needs to be a string not a number and as someone else pointed out above, your font will always be HelveticaNueve.
Just to make sure, do you know what screenW, screenH, _W and _H are? Rhetorical question since I'm going to answer it anyway.
Corona provides two API calls to get the width and height of the screen:
That's a lot of typing when you have to use it over and over again. So several programmers at the beginning of their program will create short cuts to those API calls:
_W = display.contentWidth
_H = display.contentHeight
The underscore is to make sure it doesn't conflict with any variable W or H you might use. Once you've done that you can use _W and _H has much shorter references to the width and height of the display.
Other people prefer to use screenW and screenH to do the same thing.
screenW = display.contentWidth
screenH = display.contentHeight
Most people will not mix the two, or in my case, I don't use the short cut for reasons I'm about to explain.
Since you are using storyboard, you use multiple lua files for your program, main.lua, leve1.lua, menu.lua etc. If you define these short references in main.lua, you either have to re-define them in each of your lua files, or have them as global variables, which must programmers agree should be avoided when possible. I just use the long reference and don't worry about the short cuts.
If you choose to use the short cuts, create them in main.lua, leave off the word "local" in front of them (so they become global variables) and standardize on one way or the other.
uid: 19626 topic_id: 30033 reply_id: 120678