# unexpected symbol near "."

**URL:** <https://forums.solar2d.com/t/unexpected-symbol-near/320954>\
**Category:** Outlaw Game Tools\
**Created:** [December 19, 2013, 3:31am UTC](https://forums.solar2d.com/t/unexpected-symbol-near/320954 "2013-12-19T03:31:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay0422](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jay0422](https://forums.solar2d.com/u/jay0422)\
**Post date:** [December 19, 2013, 3:31am UTC](https://forums.solar2d.com/t/unexpected-symbol-near/320954/1 "2013-12-19T03:31:17Z")

</div>

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

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

a screeny of the error

![T6J7FQj.png](http://i.imgur.com/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)

&nbsp;if(event.phase == “began”) then

&nbsp;&nbsp;

&nbsp; &nbsp; if (soundOn.isVisible == true)&nbsp;

&nbsp; &nbsp; then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundOn.isVisible = false

&nbsp; &nbsp; &nbsp; &nbsp; soundOff.isVisible = true

&nbsp; &nbsp; else

&nbsp; &nbsp; &nbsp; &nbsp; soundOn.isVisible = true

&nbsp; &nbsp; &nbsp; &nbsp; soundOff.isVisible = false

&nbsp; &nbsp; end

end

return true

end

– When music is touched

function onImageTouch(self, event)

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

&nbsp; &nbsp; if (musicOn.isVisible == true)&nbsp;

&nbsp; &nbsp; then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;musicOn.isVisible = false

&nbsp; &nbsp; &nbsp; &nbsp; musicOff.isVisible = true

&nbsp; &nbsp; else

&nbsp; &nbsp; &nbsp; &nbsp; musicOn.isVisible = true

&nbsp; &nbsp; &nbsp; &nbsp; musicOff.isVisible = false

&nbsp; &nbsp; end

&nbsp;end

&nbsp;return true

end

– When notifications is touched

function onImageTouch(self, event)

&nbsp;if(event.phase == “began”) then

&nbsp; &nbsp; if (notificationsOn.isVisible)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp; &nbsp; then

&nbsp; &nbsp; &nbsp; &nbsp; notificationsOn.isVisible = false

&nbsp; &nbsp; &nbsp; &nbsp; notificationsOff.isVisible = true

&nbsp; &nbsp; else

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;notificationsOn.isVisible = true

&nbsp; &nbsp; &nbsp; &nbsp; notificationsOff.isVisible = false &nbsp;&nbsp;

&nbsp; &nbsp; end

end

return true

end

local function backButtonTouch(event)

&nbsp;&nbsp;&nbsp;&nbsp;if(event.phase &nbsp;== “ended”) then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;storyboard.gotoScene(‘MainMenu’)

&nbsp;&nbsp;&nbsp;&nbsp;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)&nbsp;

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)&nbsp;

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

&nbsp;group:insert(musicOn)

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

notifications.x = 500

notifications.y = 600

&nbsp;group:insert(notifications)

notifications.touch = onImageTouch

notifications:addEventListener(“touch”, image)&nbsp;

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

notificationsOff.x = 500

notificationsOff.y = 700

&nbsp;group:insert(notificationsOff)

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

notificationsOn.x = 500

notificationsOn.y = 700

&nbsp;group:insert(notificationsOn)

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

&nbsp;local backButton.x = 100

&nbsp;local backButton.y = 650

&nbsp;backButton.isVisible = true

&nbsp;returnButton:addEventListener ( “touch”, backButton )

&nbsp;group:insert(backButton)

* * *

–&nbsp;

– &nbsp; &nbsp; &nbsp;NOTE:

– &nbsp; &nbsp; &nbsp;

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

–&nbsp;

* * *

* * *

– BEGINNING OF YOUR IMPLEMENTATION

* * *

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

function scene:createScene( event )

&nbsp; &nbsp; local group = self.view

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

end

– Called immediately after scene has moved onscreen:

&nbsp;&nbsp;&nbsp;&nbsp;function scene:enterScene( event )

&nbsp; &nbsp; local group = self.view

&nbsp; &nbsp; print( “1: enterScene event” )

&nbsp; &nbsp; -----------------------------------------------------------------------------

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

end

– Called when scene is about to move offscreen:

function scene:exitScene( event )

print( “1: exitScene event” )

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp;&nbsp;

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

end

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

function scene:destroyScene( event )

&nbsp;&nbsp;&nbsp;&nbsp;local group = self.view

&nbsp;&nbsp;&nbsp;&nbsp;print( “((destroying scene 1’s view))” )

&nbsp; &nbsp; &nbsp; &nbsp;

* * *

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

* * *

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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)

&nbsp;&nbsp;&nbsp;&nbsp;if(event.phase &nbsp;== “ended”) then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;storyboard.gotoScene(‘Game’)

&nbsp;&nbsp;&nbsp;&nbsp;end

end

local function settingsButtonTouch(event)

&nbsp;&nbsp;&nbsp;&nbsp;if(event.phase &nbsp;== “ended”) then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;storyboard.gotoScene(‘Settings’)

&nbsp;&nbsp;&nbsp;&nbsp;end

end

* * *

–&nbsp;

– &nbsp; &nbsp; &nbsp;NOTE:

– &nbsp; &nbsp; &nbsp;

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

–&nbsp;

* * *

* * *

– BEGINNING OF YOUR IMPLEMENTATION

* * *

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

function scene:createScene( event )

&nbsp; &nbsp; local group = self.view

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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

&nbsp; &nbsp; backgroundImage.x = display.contentWidth/2

&nbsp; &nbsp; backgroundImage.y = display.contentHeight/2

&nbsp; &nbsp; group:insert(backgroundImage)

&nbsp; &nbsp; &nbsp; &nbsp;

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

&nbsp;&nbsp;&nbsp;&nbsp;local myImageWidth = titleImage.width

&nbsp;&nbsp;&nbsp;&nbsp;local myImageHeight = titleImage.height

&nbsp;&nbsp;&nbsp;&nbsp;titleImage.x = 575

&nbsp;&nbsp;&nbsp;&nbsp;titleImage.y = 400

&nbsp;&nbsp;&nbsp;&nbsp;group:insert(titleImage)

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

&nbsp;&nbsp;&nbsp;&nbsp;local playButtonWidth = playButton.width

&nbsp;&nbsp;&nbsp;&nbsp;local playButtonHeight = playButton.height

&nbsp;&nbsp;&nbsp;&nbsp;playButton:addEventListener ( “touch”, playButtonTouch )

&nbsp;&nbsp;&nbsp;&nbsp;playButton.x = 515

&nbsp;&nbsp;&nbsp;&nbsp;playButton.y = 300

&nbsp;&nbsp;&nbsp;&nbsp;group:insert(playButton)

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

&nbsp;&nbsp;&nbsp;&nbsp;local settingsButtonWidth = settingsButton.width

&nbsp;&nbsp;&nbsp;&nbsp;local settingsButtonHeight = settingsButton.height

&nbsp;&nbsp;&nbsp;&nbsp;settingsButton:addEventListener ( “touch”, settingsButtonTouch )

&nbsp;&nbsp;&nbsp;&nbsp;settingsButton.x = 85

&nbsp;&nbsp;&nbsp;&nbsp;settingsButton.y = 689

&nbsp;&nbsp;&nbsp;&nbsp;group:insert(settingsButton)

end

– Called immediately after scene has moved onscreen:

function scene:enterScene( event )

&nbsp; &nbsp; local group = self.view

&nbsp; &nbsp; print( “1: enterScene event” )

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

end

– Called when scene is about to move offscreen:

function scene:exitScene( event )

print( “1: exitScene event” )

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp;&nbsp;

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

&nbsp; &nbsp;&nbsp;

&nbsp; &nbsp; -----------------------------------------------------------------------------

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

end

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

function scene:destroyScene( event )

&nbsp;&nbsp;&nbsp;&nbsp;local group = self.view

&nbsp;&nbsp;&nbsp;&nbsp;print( “((destroying scene 1’s view))” )

&nbsp; &nbsp; &nbsp; &nbsp;

* * *

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

* * *

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

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!&nbsp; 😃

---

<div class="post-metadata">

**Author:** ![Saerothir](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/5f9b8f/32.png) [@Saerothir](https://forums.solar2d.com/u/Saerothir)\
**Post date:** [December 19, 2013, 10:51am UTC](https://forums.solar2d.com/t/unexpected-symbol-near/320954/2 "2013-12-19T10:51:57Z")

</div>

At first glance, what is the “.” for in your rect lines?  
example: **local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)**  
Why do you have this " **./ "**?

try getting rid of the period and forward slash: **local backgroundImage = display.newImageRect(“images/background.png” , 1024, 768)**

-Saer

---

<div class="post-metadata">

**Author:** ![Saerothir](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/5f9b8f/32.png) [@Saerothir](https://forums.solar2d.com/u/Saerothir)\
**Post date:** [December 19, 2013, 10:51am UTC](https://forums.solar2d.com/t/unexpected-symbol-near/320954/3 "2013-12-19T10:51:57Z")

</div>

At first glance, what is the “.” for in your rect lines?  
example: **local backgroundImage = display.newImageRect("./images/background.png" , 1024, 768)**  
Why do you have this " **./ "**?

try getting rid of the period and forward slash: **local backgroundImage = display.newImageRect(“images/background.png” , 1024, 768)**

-Saer
