unexpected symbol near '.'

Sorry If I posted on the wrong section or if this has been solved before but my problem is;

My Code keeps saying unexpected symbol near ‘.’ and I have no idea what the problem is

a screeny of the error

T6J7FQj.png

Settings Code

[spoiler]

– Created by: Nick Porter

– Created on: Dec 2013

– Created for: ICS2O

– This program display Settings


– Settings.lua


local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

local backgroundImage

display.setDefault(“background”,225,225, 225)

storyboard.purgeOnSceneChange = true

display.setStatusBar(display.HiddenStatusBar)

– local functions go here

– When sound is touched

function onImageTouch(self, event)

 if(event.phase == “began”) then

  

    if (soundOn.isVisible == true) 

    then

         soundOn.isVisible = false

        soundOff.isVisible = true

    else

        soundOn.isVisible = true

        soundOff.isVisible = false

    end

end

return true

end

– When music is touched

function onImageTouch(self, event)

if(event.phase == “began”) then

    if (musicOn.isVisible == true) 

    then

         musicOn.isVisible = false

        musicOff.isVisible = true

    else

        musicOn.isVisible = true

        musicOff.isVisible = false

    end

 end

 return true

end

– When notifications is touched

function onImageTouch(self, event)

 if(event.phase == “began”) then

    if (notificationsOn.isVisible)     

    then

        notificationsOn.isVisible = false

        notificationsOff.isVisible = true

    else

         notificationsOn.isVisible = true

        notificationsOff.isVisible = false   

    end

end

return true

end

local function backButtonTouch(event)

    if(event.phase  == “ended”) then

        storyboard.gotoScene(‘MainMenu’)

    end

end

local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)

backgroundImage.x = display.contentWidth/2

backgroundImage.y = display.contentHeight/2

group:insert(backgroundImage)

local sound = display.newImageRect("./images/sound.png", 176,88)

sound.x = 500

sound.y = 200

group:insert(sound)

sound.touch = onImageTouch

sound:addEventListener(“touch”, image) 

local soundOff = display.newImageRect("./images/off.png", 91,52)

soundOff.x = 500

soundOff.y = 300

group:insert(soundOff)

local soundOn = display.newImageRect("./images/on.png", 91,52)

soundOn.x = 500

soundOn.y = 300

group:insert(soundOn)

local music = display.newImageRect("./images/music.png", 176,88)

music.x = 500

music.y = 400

group:insert(music)

music.touch = onImageTouch

music:addEventListener(“touch”, image) 

local musicOff = display.newImageRect("./images/off.png", 91,52)

musicOff.x = 500

musicOff.y = 500

group:insert(musicOff)

local musicOn = display.newImageRect("./images/on.png", 91,52)

musicOn.x = 500

musicOn.y = 500

 group:insert(musicOn)

local notifications = display.newImageRect("./images/notifications.png", 176,88)

notifications.x = 500

notifications.y = 600

 group:insert(notifications)

notifications.touch = onImageTouch

notifications:addEventListener(“touch”, image) 

local notificationsOff = display.newImageRect("./images/off.png", 91,52)

notificationsOff.x = 500

notificationsOff.y = 700

 group:insert(notificationsOff)

local notificationsOn = display.newImageRect("./images/on.png", 91,52)

notificationsOn.x = 500

notificationsOn.y = 700

 group:insert(notificationsOn)

 local backButton = display.newImageRect("./images/backButton.png", 176, 176)

 local backButton.x = 100

 local backButton.y = 650

 backButton.isVisible = true

 returnButton:addEventListener ( “touch”, backButton )

 group:insert(backButton)


– 

–      NOTE:

–      

–      Code outside of listener functions (below) will only be executed once,

– 



– BEGINNING OF YOUR IMPLEMENTATION


– Called when the scene’s view does not exist:

function scene:createScene( event )

    local group = self.view

    

    -----------------------------------------------------------------------------

            

    –      CREATE display objects and add them to ‘group’ here.

    –      Example use-case: Restore ‘group’ from previously saved state.

    

    -----------------------------------------------------------------------------

end

– Called immediately after scene has moved onscreen:

    function scene:enterScene( event )

    local group = self.view

    print( “1: enterScene event” )

    -----------------------------------------------------------------------------

    –      INSERT code here (e.g. start timers, load audio, start listeners, etc.)

    

    -----------------------------------------------------------------------------

end

– Called when scene is about to move offscreen:

function scene:exitScene( event )

print( “1: exitScene event” )

    -----------------------------------------------------------------------------

    

    –      INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)

    

    -----------------------------------------------------------------------------

                 

end

– Called prior to the removal of scene’s “view” (display group)

function scene:destroyScene( event )

    local group = self.view

    print( “((destroying scene 1’s view))” )

       


–      INSERT code here (e.g. remove listeners, widgets, save state, etc.)


        

end


– END OF YOUR IMPLEMENTATION


– “createScene” event is dispatched if scene’s view does not exist

scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished

scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins

scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be

– automatically unloaded in low memory situations, or explicitly via a call to

– storyboard.purgeScene() or storyboard.removeScene().

scene:addEventListener( “destroyScene”, scene )


return scene

[/spoiler]

Main Menu Code]

[spoiler]

– Created by: Jason Damasco

– Created on: Nov 2013

– Created for: ICS2O

– This program display Main Menu


– MainMenu.lua


local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

local backgroundImage

display.setDefault(“background”,225,225, 225)

storyboard.purgeOnSceneChange = true

display.setStatusBar(display.HiddenStatusBar)

– local functions go here

local function playButtonTouch(event)

    if(event.phase  == “ended”) then

        storyboard.gotoScene(‘Game’)

    end

end

local function settingsButtonTouch(event)

    if(event.phase  == “ended”) then

        storyboard.gotoScene(‘Settings’)

    end

end


– 

–      NOTE:

–      

–      Code outside of listener functions (below) will only be executed once,

– 



– BEGINNING OF YOUR IMPLEMENTATION


– Called when the scene’s view does not exist:

function scene:createScene( event )

    local group = self.view

    

    -----------------------------------------------------------------------------

            

    –      CREATE display objects and add them to ‘group’ here.

    –      Example use-case: Restore ‘group’ from previously saved state.

    

    -----------------------------------------------------------------------------

                

    local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)

    backgroundImage.x = display.contentWidth/2

    backgroundImage.y = display.contentHeight/2

    group:insert(backgroundImage)

       

    local titleImage = display.newImageRect ("./images/mainMenu.png", 1024, 768)

    local myImageWidth = titleImage.width

    local myImageHeight = titleImage.height

    titleImage.x = 575

    titleImage.y = 400

    group:insert(titleImage)

    local playButton = display.newImageRect ("./images/playButton.png", 176, 88)

    local playButtonWidth = playButton.width

    local playButtonHeight = playButton.height

    playButton:addEventListener ( “touch”, playButtonTouch )

    playButton.x = 515

    playButton.y = 300

    group:insert(playButton)

    local settingsButton = display.newImageRect ("./images/settings.png", 176, 176)

    local settingsButtonWidth = settingsButton.width

    local settingsButtonHeight = settingsButton.height

    settingsButton:addEventListener ( “touch”, settingsButtonTouch )

    settingsButton.x = 85

    settingsButton.y = 689

    group:insert(settingsButton)

end

– Called immediately after scene has moved onscreen:

function scene:enterScene( event )

    local group = self.view

    print( “1: enterScene event” )

    -----------------------------------------------------------------------------

            

    –      INSERT code here (e.g. start timers, load audio, start listeners, etc.)

    

    -----------------------------------------------------------------------------

end

– Called when scene is about to move offscreen:

function scene:exitScene( event )

print( “1: exitScene event” )

    -----------------------------------------------------------------------------

    

    –      INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)

    

    -----------------------------------------------------------------------------

                 

end

– Called prior to the removal of scene’s “view” (display group)

function scene:destroyScene( event )

    local group = self.view

    print( “((destroying scene 1’s view))” )

       


–      INSERT code here (e.g. remove listeners, widgets, save state, etc.)


        

end


– END OF YOUR IMPLEMENTATION


– “createScene” event is dispatched if scene’s view does not exist

scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished

scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins

scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be

– automatically unloaded in low memory situations, or explicitly via a call to

– storyboard.purgeScene() or storyboard.removeScene().

scene:addEventListener( “destroyScene”, scene )


return scene

[/spoiler]

And If anyone could help me with the “gotoScene” error that would be great! :smiley:

One thing I see in your Settings.lua is that the code from “local backgroundImage = …” all the way to “group:insert(backButton)” is outside the createScene function.

One thing I see in your Settings.lua is that the code from “local backgroundImage = …” all the way to “group:insert(backButton)” is outside the createScene function.

Hello I have similar problem and I don’t know what to do, first problem was about “graphicsCompatibilty” I added a file “config.lua” inclueded this code: graphicsCompatibility = 1,
Now it exist that problem:

error loading module 'start' from file 'c'\users......\start.lua4: unexpected symbol near 'local' stach traceback: [C]:? [C]:in function 'gotoScene' c:\.......\main.lua:5: in main chunk do you want to relaunch the project?  

I hope someone can tell me how can I fix that.

Thanks

All file is here:
http://www.mediafire.com/download/tz4tizasm6ww4r8/sideScroller.zip
i found it from here:
youtube.com/

Hi @ufuk_koc91,

I did not get your error. What corona version are you using?

But it shows other error which is related to sprite usage.

The code uses sprite which have since been deprecated.

You can either re-code to the new display.newSprite 

or

you can download the sprite library (no longer supported) which coronalab upload to github. 

https://github.com/coronalabs/framework-sprite-legacy

if you choose the second option then you need to place the sprite.lua into the root folder and

do some editing to your game.lua

change

–require “sprite”

to

local sprite = require(“sprite”)

It works on my corona mac version 2100.

Good luck!

burhan

Hello Burhan!
Thank you so much for your reply!

now it runs!

I am new at proggramming and in Corona, I m trying to learn from tutorials, but mostly  I have problem, I download files of tutorials, when I run them, mostly it gives error.
Check this please:

first problem was about graphicsCompatibility, I fixed but later it gives this error:
http://oi61.tinypic.com/2yl3ede.jpg

Why all these happen? I am usuing windows 7 and CoronaSDK-2013.2100, these problems exist because of I use corona for windows and the files I want to use made in Mac?
what should I do? should I buy Corona Basic or Pro or should I have got Macbook?

Hello I have similar problem and I don’t know what to do, first problem was about “graphicsCompatibilty” I added a file “config.lua” inclueded this code: graphicsCompatibility = 1,
Now it exist that problem:

error loading module 'start' from file 'c'\users......\start.lua4: unexpected symbol near 'local' stach traceback: [C]:? [C]:in function 'gotoScene' c:\.......\main.lua:5: in main chunk do you want to relaunch the project?  

I hope someone can tell me how can I fix that.

Thanks

All file is here:
http://www.mediafire.com/download/tz4tizasm6ww4r8/sideScroller.zip
i found it from here:
youtube.com/

Hi @ufuk_koc91,

I did not get your error. What corona version are you using?

But it shows other error which is related to sprite usage.

The code uses sprite which have since been deprecated.

You can either re-code to the new display.newSprite 

or

you can download the sprite library (no longer supported) which coronalab upload to github. 

https://github.com/coronalabs/framework-sprite-legacy

if you choose the second option then you need to place the sprite.lua into the root folder and

do some editing to your game.lua

change

–require “sprite”

to

local sprite = require(“sprite”)

It works on my corona mac version 2100.

Good luck!

burhan

Hello Burhan!
Thank you so much for your reply!

now it runs!

I am new at proggramming and in Corona, I m trying to learn from tutorials, but mostly  I have problem, I download files of tutorials, when I run them, mostly it gives error.
Check this please:

first problem was about graphicsCompatibility, I fixed but later it gives this error:
http://oi61.tinypic.com/2yl3ede.jpg

Why all these happen? I am usuing windows 7 and CoronaSDK-2013.2100, these problems exist because of I use corona for windows and the files I want to use made in Mac?
what should I do? should I buy Corona Basic or Pro or should I have got Macbook?

im having an issue trying to figure this problem out… for some reason I am getting a main.lua:1: unexpected symbol near ‘?’   which falls on the first line "require(“physics”)…  but I was following the step by step from a guy on youtube to create this game. I have been searching and I cannot see any errors. what seems to be the problem??

require (“physics”)

 function main()
    setUpPhysics()
  createWalls()
  createBricks()
  createBall()
  createPaddle()
  startGame()
 
 
 end
 
 
 function setUpPhysics()
 physics.start()
  --physics.setDrawMode(“hybrid”)
  physics.setGravity(0,0)
 end
 
 
 
 
 function createPaddle()
  
  local paddleWidth = 100
  local paddleHeight = 10
  
  local paddle = display.newRect( display.contentWidth / 2 - paddleWidth / 2, display.contentHeight - 50, paddleWidth, paddleHeight )
  physics.addBody(paddle, “static”, {friction=0, bounce=1})
 
 
  local  movePaddle = function(event)
    paddle.x = event.x
  end
 
 
  Runtime:addEventListener(“touch”, movePaddle)
  
 end
 
 
 
 
 function createBall()
 
 
  local ballRadius = 10
 
 
  ball = display.newCircle( display.contentWidth / 2, display.contentHeight / 2, ballRadius )
  physics.addBody(ball, “dynamic”, {friction=0, bounce = 1, radius=ballRadius})
 
 
  ball.collision = function(self, event)
   if(event.phase == “ended”) then
    
    if(event.other.type == “destructible”) then
     event.other:removeSelf()
    end
    
    if(event.other.type == “bottomWall”) then
    
     self:removeSelf()
     
     local onTimerComplete = function(event)
      createBall()
      startGame()
     end
     
     timer.performWithDelay(500, onTimerComplete , 1)
    end
   end
  end
 
 
  ball:addEventListener(“collision”, ball)
 end
 
 
 function startGame()
  ball:setLinearVelocity(75, 150) 
 end
 
 
 
 function createBricks()
  
  local brickWidth = 40
  local brickHeight = 20
   
  local numOfRows = 4
  local numOfCols = 6
  
  local topLeft = {x= display.contentWidth / 2 - (brickWidth * numOfCols ) / 2, y= 50}
  
  local row
  local col
  
  for row = 0, numOfRows - 1 do
   for col = 0, numOfCols - 1 do
   
    – Create a brick
    local brick = display.newRect( topLeft.x + (col * brickWidth), topLeft.y + (row * brickHeight), brickWidth, brickHeight )
    brick:setFillColor(math.random(50, 255), math.random(50, 255), math.random(50, 255), 255)
    brick.type = “destructible”
    
    physics.addBody(brick, “static”, {friction=0, bounce = 1})
   end
  end
 end
 
 
 
 
 function createWalls()
  
  local wallThickness = 10
  
  – Left wall
  local wall = display.newRect( 0, 0, wallThickness, display.contentHeight )
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
 – Top wall
  wall = display.newRect(0,0, display.contentWidth, wallThickness)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  – Right wall
  wall = display.newRect(display.contentWidth - wallThickness, 0, wallThickness, display.contentHeight)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  – Bottom wall
  wall = display.newRect(0, display.contentHeight - wallThickness, display.contentWidth, wallThickness)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  wall.type = “bottomWall”
 end
 
main()

Hi @jgarcia6790,

You need to set the require to a variable, like this:

[lua]

local physics = require( “physics” )

[/lua]

Take care,

Brent

im having an issue trying to figure this problem out… for some reason I am getting a main.lua:1: unexpected symbol near ‘?’   which falls on the first line "require(“physics”)…  but I was following the step by step from a guy on youtube to create this game. I have been searching and I cannot see any errors. what seems to be the problem??

require (“physics”)

 function main()
    setUpPhysics()
  createWalls()
  createBricks()
  createBall()
  createPaddle()
  startGame()
 
 
 end
 
 
 function setUpPhysics()
 physics.start()
  --physics.setDrawMode(“hybrid”)
  physics.setGravity(0,0)
 end
 
 
 
 
 function createPaddle()
  
  local paddleWidth = 100
  local paddleHeight = 10
  
  local paddle = display.newRect( display.contentWidth / 2 - paddleWidth / 2, display.contentHeight - 50, paddleWidth, paddleHeight )
  physics.addBody(paddle, “static”, {friction=0, bounce=1})
 
 
  local  movePaddle = function(event)
    paddle.x = event.x
  end
 
 
  Runtime:addEventListener(“touch”, movePaddle)
  
 end
 
 
 
 
 function createBall()
 
 
  local ballRadius = 10
 
 
  ball = display.newCircle( display.contentWidth / 2, display.contentHeight / 2, ballRadius )
  physics.addBody(ball, “dynamic”, {friction=0, bounce = 1, radius=ballRadius})
 
 
  ball.collision = function(self, event)
   if(event.phase == “ended”) then
    
    if(event.other.type == “destructible”) then
     event.other:removeSelf()
    end
    
    if(event.other.type == “bottomWall”) then
    
     self:removeSelf()
     
     local onTimerComplete = function(event)
      createBall()
      startGame()
     end
     
     timer.performWithDelay(500, onTimerComplete , 1)
    end
   end
  end
 
 
  ball:addEventListener(“collision”, ball)
 end
 
 
 function startGame()
  ball:setLinearVelocity(75, 150) 
 end
 
 
 
 function createBricks()
  
  local brickWidth = 40
  local brickHeight = 20
   
  local numOfRows = 4
  local numOfCols = 6
  
  local topLeft = {x= display.contentWidth / 2 - (brickWidth * numOfCols ) / 2, y= 50}
  
  local row
  local col
  
  for row = 0, numOfRows - 1 do
   for col = 0, numOfCols - 1 do
   
    – Create a brick
    local brick = display.newRect( topLeft.x + (col * brickWidth), topLeft.y + (row * brickHeight), brickWidth, brickHeight )
    brick:setFillColor(math.random(50, 255), math.random(50, 255), math.random(50, 255), 255)
    brick.type = “destructible”
    
    physics.addBody(brick, “static”, {friction=0, bounce = 1})
   end
  end
 end
 
 
 
 
 function createWalls()
  
  local wallThickness = 10
  
  – Left wall
  local wall = display.newRect( 0, 0, wallThickness, display.contentHeight )
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
 – Top wall
  wall = display.newRect(0,0, display.contentWidth, wallThickness)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  – Right wall
  wall = display.newRect(display.contentWidth - wallThickness, 0, wallThickness, display.contentHeight)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  – Bottom wall
  wall = display.newRect(0, display.contentHeight - wallThickness, display.contentWidth, wallThickness)
  physics.addBody(wall, “static”, {friction=0, bounce = 1})
  
  wall.type = “bottomWall”
 end
 
main()

Hi @jgarcia6790,

You need to set the require to a variable, like this:

[lua]

local physics = require( “physics” )

[/lua]

Take care,

Brent