Trouble coding while watching help videos: Error message with code!

Hi, I recently downloaded Corona SDK (Version 2014.2511 (2014.11.18) to get started and I’ve come in to a problem at the beginning. Watching “Creating your first project video”, it has one enter in the first two lines of code as shown below.


– main.lua


local physics = require( “physics”)

physics.start()

local sky = display.newImage( “bkg_clouds.png” )

All above coding is as is (no different mind you). I pressed short cut Command S, since I’m using a Mac running on OS X Yosemite version 10.10.1 (14b25), to refresh the update. I received an error as seen below.

Corona Simulator Syntax error

File: main.lua

Line: 7

Unexpected symbol near ‘‚’

It is expected to load up the sky image displaying it on the iPhone simulator. I am new at the game, so I assume I don’t have the sky file or something. I’m sure its something I’ve done wrong, but I don’t know what. I even tried using a different image, but of-course the entry uses sky reference, so I wouldn’t know where to start. I did, however, try placing the “–” before each line of code for the above and the same message appears. I read somewhere that this is typed in for each, but ma not be what I thought.

Anyways it would look lIke this for each line of code, but I’m only showing this one example.

–local sky = display.newImage( “bkg_clouds.png” )

What is my issue do you think? The screen capture attachments just show what I’ve already written.

It looks to me like you are using “smart quotes” around the file name on your display.newImage() call.  The quote marks have to be the ASCII quotes from the keyboard.  Word Processors like Microsoft Word, Apple Pages, etc. will sometimes convert the standard quote marks in to smart quotes (the left quote is curled to point into the text, the right quote is also curled in).  Standard quotes are typically straight.

You should use a standard text editor to edit your code.

Rob

I assume the text editor is the one Corona SDK downloaded with the program. Am I wrong? I took a look in my applications folder and found the only text editor my Mac has and it is certainly a different one than the one in the pic I sent in my original post. Any ideas? Maybe I should try using the Mac’s text editor?

By the way I did not know how to attach a new image to my reply message. Forums are new to me too, so this would help in my future communication if you could point out how to attach a new photo to a reply (not a pic already existing in my media area). Thanks!

Corona SDK does not ship with an editor.  It looks like you are using the Mac default “textedit”.  Text edit defaults to rich text editing which is probably the source of your problems.  There may be a way to tell textedit to not use smart quotes, but most people are going to either use a better text editor that does syntax highlighting, indenting and other features that are desirable for programmers.

Look to install TextWrangler as a Free option.  Many of us like Sublime Text as our editor of choice.  You might want to spend some time going through the Newbie forum and some of the pinned posts like this one:

http://forums.coronalabs.com/topic/1779-essential-mac-apps-for-corona-development/

Rob

No prob Rob! Thanks for your assistance. I wasn’t sure about the text editor, because both programs looked different when I opened them. Just a two and two assumption.

I will certainly keep in mind the possibility of ceasing the smart quotes for future troubleshooting. Thanks for your direction! This one (me) needs a prayer lol.

Hey Rob, thanks for the new text editor. Here’s the thing though. The coding is, in-fact, functioning now, but it seems my suspicion was correct regarding the image “bkg_clouds.png”. I searched for some simple png files before I sent my first post to test out the issue. Needless to say it didn’t work.

Well, now that you pointed me to the new editor I was able to replace that image with the test image I found and it loaded up like a champ, so thanks much. LOL, I think sky in the code is just a code word for background. I hope I’m right, because I will begin to catch on with the meanings in the code if I can rely on this. :smiley:

It looks to me like you are using “smart quotes” around the file name on your display.newImage() call.  The quote marks have to be the ASCII quotes from the keyboard.  Word Processors like Microsoft Word, Apple Pages, etc. will sometimes convert the standard quote marks in to smart quotes (the left quote is curled to point into the text, the right quote is also curled in).  Standard quotes are typically straight.

You should use a standard text editor to edit your code.

Rob

I assume the text editor is the one Corona SDK downloaded with the program. Am I wrong? I took a look in my applications folder and found the only text editor my Mac has and it is certainly a different one than the one in the pic I sent in my original post. Any ideas? Maybe I should try using the Mac’s text editor?

By the way I did not know how to attach a new image to my reply message. Forums are new to me too, so this would help in my future communication if you could point out how to attach a new photo to a reply (not a pic already existing in my media area). Thanks!

Corona SDK does not ship with an editor.  It looks like you are using the Mac default “textedit”.  Text edit defaults to rich text editing which is probably the source of your problems.  There may be a way to tell textedit to not use smart quotes, but most people are going to either use a better text editor that does syntax highlighting, indenting and other features that are desirable for programmers.

Look to install TextWrangler as a Free option.  Many of us like Sublime Text as our editor of choice.  You might want to spend some time going through the Newbie forum and some of the pinned posts like this one:

http://forums.coronalabs.com/topic/1779-essential-mac-apps-for-corona-development/

Rob

No prob Rob! Thanks for your assistance. I wasn’t sure about the text editor, because both programs looked different when I opened them. Just a two and two assumption.

I will certainly keep in mind the possibility of ceasing the smart quotes for future troubleshooting. Thanks for your direction! This one (me) needs a prayer lol.

Hey Rob, thanks for the new text editor. Here’s the thing though. The coding is, in-fact, functioning now, but it seems my suspicion was correct regarding the image “bkg_clouds.png”. I searched for some simple png files before I sent my first post to test out the issue. Needless to say it didn’t work.

Well, now that you pointed me to the new editor I was able to replace that image with the test image I found and it loaded up like a champ, so thanks much. LOL, I think sky in the code is just a code word for background. I hope I’m right, because I will begin to catch on with the meanings in the code if I can rely on this. :smiley: