I keep getting this error and nothing's working!

im getting this error that says :

error loading module ‘scene_menu’ form file ‘scene_menu.lua’:

                scene_menu.lua:24: ‘<eof>’ expected near ‘local’

stack traceback:

                  [C]: in function ‘error’

                   ?: in function ‘gotoScene’

                   main.lua:4: in main chunk

Do you want to relaunch the project?

Nothing works! im looking at templates, online forums a lot, and nothing works!

Let me show you my main.lua file

 display.setStatusBar( display.HiddenStatusBar )                 – hide the status bar

local storyboard = require “storyboard”                              

storyboard.gotoScene( “scene_menu” )   

– this is my background 

local background = display.newImage( “bkg_bricks.png”, centerX, centerY, true )

background.x = display.contentCenterX

background.y = display.contentCenterY

– My text you see here 

local myText = display.newText( “Make sure the cube doesn’t fall!”, 0, 0, native.systemFont, 20 )

myText:setFillColor( 0, 0, 0 )

myText.anchorX = 0

myText.x = 10

myText.y = 140

local myText = display.newText( “Coded by blank blank”, 0, 0, native.systemFont, 10 )

myText:setFillColor( 0, 0, 0 )

myText.anchorX = 0

myText.x = 1

myText.y = 520

– score

local score = 0  

local scoreLabel = display.newText( score, 0, 0, native.systemFontBold, 30 )  

scoreLabel.x = display.viewableContentWidth / 2  

scoreLabel.y = display.viewableContentHeight / 15 

scoreLabel:setTextColor( 0, 0, 0, 10 )

– the line under “MAKESURETHECUBEDOESNTFALL”

local myRectangle = display.newRect( 150, 155, 250, 0.5 )

myRectangle.strokeWidth = 2

myRectangle:setFillColor( 1 )

myRectangle:setStrokeColor( 0, 0, 0 )

– interact-able  square stuff

local physics = require “physics”

physics.start()

local character = display.newImage( “square.png” )

character.x = 70

character.y = 230

physics.addBody( character, {friction=1.0, density=1.0, bounce=0 } ) 

character.isFixedRotation = true

–end main

and my scene menu file here

–storyboard

local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

function scene:createScene( event )

    local group = self.view

    local background = display.newImage( “splashscreen.jpg” )    

    group:insert ( background )    

end

function scene:enterScene( event )

    local group = self.view    

end

function scene:exitScene( event )

    local group = self.view    

end

function scene:destroyScene( event )

    local group = self.view            

end

scene:addEventListener( “createScene”, scene )

scene:addEventListener( “enterScene”, scene )

scene:addEventListener( “exitScene”, scene )

scene:addEventListener( “destroyScene”, scene )

return scene

– making the composer/new scene

local storyboard = require ( “storyboard” )       

local scene = composer.newScene()  

local storyboard = require( “storyboard” )                

local scene = storyboard.newScene()

– making widget

local widget = require (“widget”)

     

– button function

local function onButtonRelease (event)

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

print “event began”

elseif ( event.phase == “moved” ) then

print “event moved”

    elseif ( event.phase == “ended” or event.phase == “cancelled” ) then

    print “event ended”

        if ( event.target.id == “newGame” ) then

            composer.gotoScene( “screens.gameLevel”, “crossFade”, 1000 )

        elseif ( event.target.id == “credits” ) then

            composer.gotoScene( “screens.creditScreen”, “crossFade”, 1000 )

        end

    end

    return true

end

– for composer purposes

function scene:create( event )

    local mainGroup = self.view 

end

– button identity and such

local buttonPlay = widget.newButton{ – Button creation

        id = “Play”, – Button ID

        label = “PLAY”,

        font = native.systemFontBold,

        fontSize = 64,

        labelColor = { default = { 1, 1, 1 }, over = { 0, 0, 0 } },

        textOnly = true,

        width = 372,

        height = 158,

        onEvent = onButtonRelease

}

    buttonPlay.x = display.contentCenterX

    buttonPlay.y = 250

    mainGroup:insert(buttonPlay)

– function

function scene:show( event )

    local phase = event.phase

    if ( phase == “will” ) then        

    elseif ( phase == “did” ) then      

   

    composer.removeScene( “screens.gameLevel” )

end

end

– function scenes

function scene:hide( event )

    local phase = event.phase

    if ( phase == “will” ) then         – Scene is not off the screen entirely

    elseif ( phase == “did” ) then      – Scene is off the screen

    end

end

– functionable scenes

function scene:hide( event )

    local phase = event.phase

    if ( phase == “will” ) then         – Scene is not off the screen entirely

    elseif ( phase == “did” ) then      – Scene is off the screen

    end

end

function scene:destroy( event )

    local phase = event.phase

if ( phase == “will” ) then 

elseif ( phase == “did” ) then 

end

end

function scene:destroy( event )

end

return scene

– end

I really need help! 

Welcome to the forums.  We have a few rules and suggestions to help you be successful and get the answers you need.

  1. Always post formatted code.  Your code is very hard to read. The easiest way to do this is to use the <> button in the forum post formatting bar (Bold, Italic, etc.).  Paste your code into the window that pops up when you click on the <> button.

  2. Only post as much code as needed to explain the issue.

  3. Take some time and read our guides, in particular the debugging guide at http://docs.coronalabs.com/guide/basics/debugging/index.html

Now for this issue, your error reads:

error loading module 'scene\_menu' form file 'scene\_menu.lua': scene\_menu.lua:24: '\<eof\>' expected near 'local' stack traceback: [C]: in function 'error' ?: in function 'gotoScene' main.lua:4: in main chunk

So you are having an error trying to load a scene. The scene is named “scene_menu”.  The error is on line 24.  <eof> means you have a mismatch of block definitions (functions, if’s, for’s) and their matching “end” statements.  This was called from a function named gotoScene() in your main.lua on line 4.

Line 24 is “return scene”.  This line is always the **LAST** line in a Storyboard or Composer scene. You cannot have any code after it.

So you need to probably study how Composer and Storyboard scenes work and figure out why you have code after the scene ends.

Rob

Hello. I dont expect you to hold my hand in this process, but…

i kind of dont know what to do to fix this solution. So far, Rob, i have been trying to study the coding when it comes to go to scene, however, i cant start in the middle of the language and expect to find myself doing pretty good.

So in my case, can you kind of…you know, tell me in more detail?

A 14 year older shouldn’t worry about coding, they focus on things like…“video game testing” or something very dramatic, but i want to develop this app. If i could do this, Rob, if youre still there, i would be eternally grateful.

Thanks.

(post scriptum, whats the best way of learning lua?)

If we took the time to explain things in detail to each individual, we would say the same thing over and over. This is why we provide many different ways of educating many people at once.  We write:

Guideshttps://docs.coronalabs.com/guide/index.html

These cover various topics in detail. The one that seems relevant here is the Composer Library guide (https://docs.coronalabs.com/guide/index.html)

Corona University: https://coronalabs.com/resources/tutorials/getting-started-with-corona/

This is a collection of Videos, Tutorials, and links to the Guides that help you learn various topics.

Tutorials: https://coronalabs.com/blog/

Every Tuesday we publish a tutorial on various topics.  We’ve covered Composer quite a bit there as well. Many of these are linked from Corona University.

Forum Posts : https://forums.coronalabs.com

You can go back and ready the countless number of posts that are related to the question you need. The forums have their own search or you can use Google to search for Documents, Guides, Tutorials and Forum Posts.

Sample Code : https://github.com/coronalabs/samples-coronasdk

We include many sample apps with the Corona SDK download.  On a PC its in C:\Program Files(x86)\Corona Labs\CoronaSDK\SampleCode or something like that. On a Mac, it’s /Applications/CoronaSDK/SampleCode. 

In everyone of these cases, for Composer, we have provided a basic “Template” for what goes into a scene.  You have to put code in certain places (and all these resources tell you how).  But just to clarify

-- required first two lines local composer = require( "composer" ) local scene = composer.newScene() -- here you require the other things you need: local physics = require( "physics" ) local widget = require( "widget" ) -- etc. -- here you declare all your local variables: local score = 0 -- here you declare all your local functions:&nbsp; -- whatever your code requires... local function doSomething() &nbsp;&nbsp;&nbsp; score = score + 1 end -- now comes four required functions for Composer: function scene:create( event ) &nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp; -- put any thing you need to create here &nbsp;&nbsp;&nbsp; local background = display.newRect(display.contentCenterX, display.contentCenterY, display.contentWidth,&nbsp; display.contentHeight) &nbsp;&nbsp;&nbsp; -- you must put the object in the group to have composer manage it: &nbsp;&nbsp;&nbsp; sceneGroup:insert ( background ) &nbsp;&nbsp;&nbsp; -- the rest of your creations go here end function scene:show( event ) &nbsp;&nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; if event.phase == "will" then &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- put code here you want to happen just before the scene comes on the screen &nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- put code here you want to happen after the scene comes on the screen &nbsp;&nbsp;&nbsp; end end function scene:hide( event ) &nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; if event.phase == "will" then &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- put code here you want to happen just before the scene leaves the screen &nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- put code here you want to happen after the scene has left the screen &nbsp;&nbsp;&nbsp; end end function scene:destroy( event ) &nbsp;&nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; -- put code here if you have things you need to remove that you created in create scene that does NOT go into the sceneGroup) end -- these must be the last 5 lines in the file scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) return scene

Now I just typed that in so there may be typos. Do yourself a favor and copy the code from the Composer Guide for the default template and use it as the base for every scene you create.  Add your content in the right place.  If the text in the guides and tutorials are not explaining to you where to put things, study the sample code and learn from there.

Rob

Hi

I have a published app in Google Playstore and now its giving me this error

in com.google.android.gms.internal.dw$h.b

and the following is in the console

java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$b.bR(Unknown Source)
at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)

how can this be resolved?

Did you test on a device before uploading?

no I had not tested on device maybe let me try it and give feedback

Rob, you’re an absolute lifesaver. Im Actually studying lua now, so i dont think ill be asking anymore questions from now on.

Once again your an absolute lifesaver for going through that process.

Welcome to the forums.  We have a few rules and suggestions to help you be successful and get the answers you need.

  1. Always post formatted code.  Your code is very hard to read. The easiest way to do this is to use the <> button in the forum post formatting bar (Bold, Italic, etc.).  Paste your code into the window that pops up when you click on the <> button.

  2. Only post as much code as needed to explain the issue.

  3. Take some time and read our guides, in particular the debugging guide at http://docs.coronalabs.com/guide/basics/debugging/index.html

Now for this issue, your error reads:

error loading module 'scene\_menu' form file 'scene\_menu.lua': scene\_menu.lua:24: '\<eof\>' expected near 'local' stack traceback: [C]: in function 'error' ?: in function 'gotoScene' main.lua:4: in main chunk

So you are having an error trying to load a scene. The scene is named “scene_menu”.  The error is on line 24.  <eof> means you have a mismatch of block definitions (functions, if’s, for’s) and their matching “end” statements.  This was called from a function named gotoScene() in your main.lua on line 4.

Line 24 is “return scene”.  This line is always the **LAST** line in a Storyboard or Composer scene. You cannot have any code after it.

So you need to probably study how Composer and Storyboard scenes work and figure out why you have code after the scene ends.

Rob

Hello. I dont expect you to hold my hand in this process, but…

i kind of dont know what to do to fix this solution. So far, Rob, i have been trying to study the coding when it comes to go to scene, however, i cant start in the middle of the language and expect to find myself doing pretty good.

So in my case, can you kind of…you know, tell me in more detail?

A 14 year older shouldn’t worry about coding, they focus on things like…“video game testing” or something very dramatic, but i want to develop this app. If i could do this, Rob, if youre still there, i would be eternally grateful.

Thanks.

(post scriptum, whats the best way of learning lua?)

If we took the time to explain things in detail to each individual, we would say the same thing over and over. This is why we provide many different ways of educating many people at once.  We write:

Guideshttps://docs.coronalabs.com/guide/index.html

These cover various topics in detail. The one that seems relevant here is the Composer Library guide (https://docs.coronalabs.com/guide/index.html)

Corona University: https://coronalabs.com/resources/tutorials/getting-started-with-corona/

This is a collection of Videos, Tutorials, and links to the Guides that help you learn various topics.

Tutorials: https://coronalabs.com/blog/

Every Tuesday we publish a tutorial on various topics.  We’ve covered Composer quite a bit there as well. Many of these are linked from Corona University.

Forum Posts : https://forums.coronalabs.com

You can go back and ready the countless number of posts that are related to the question you need. The forums have their own search or you can use Google to search for Documents, Guides, Tutorials and Forum Posts.

Sample Code : https://github.com/coronalabs/samples-coronasdk

We include many sample apps with the Corona SDK download.  On a PC its in C:\Program Files(x86)\Corona Labs\CoronaSDK\SampleCode or something like that. On a Mac, it’s /Applications/CoronaSDK/SampleCode. 

In everyone of these cases, for Composer, we have provided a basic “Template” for what goes into a scene.  You have to put code in certain places (and all these resources tell you how).  But just to clarify

-- required first two lines local composer = require( "composer" ) local scene = composer.newScene() -- here you require the other things you need: local physics = require( "physics" ) local widget = require( "widget" ) -- etc. -- here you declare all your local variables: local score = 0 -- here you declare all your local functions:&nbsp; -- whatever your code requires... local function doSomething() &nbsp;&nbsp;&nbsp; score = score + 1 end -- now comes four required functions for Composer: function scene:create( event ) &nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp; -- put any thing you need to create here &nbsp;&nbsp;&nbsp; local background = display.newRect(display.contentCenterX, display.contentCenterY, display.contentWidth,&nbsp; display.contentHeight) &nbsp;&nbsp;&nbsp; -- you must put the object in the group to have composer manage it: &nbsp;&nbsp;&nbsp; sceneGroup:insert ( background ) &nbsp;&nbsp;&nbsp; -- the rest of your creations go here end function scene:show( event ) &nbsp;&nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; if event.phase == "will" then &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- put code here you want to happen just before the scene comes on the screen &nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- put code here you want to happen after the scene comes on the screen &nbsp;&nbsp;&nbsp; end end function scene:hide( event ) &nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; if event.phase == "will" then &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- put code here you want to happen just before the scene leaves the screen &nbsp;&nbsp;&nbsp;&nbsp; else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- put code here you want to happen after the scene has left the screen &nbsp;&nbsp;&nbsp; end end function scene:destroy( event ) &nbsp;&nbsp;&nbsp;&nbsp; local sceneGroup = self.view &nbsp;&nbsp;&nbsp;&nbsp; -- put code here if you have things you need to remove that you created in create scene that does NOT go into the sceneGroup) end -- these must be the last 5 lines in the file scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) return scene

Now I just typed that in so there may be typos. Do yourself a favor and copy the code from the Composer Guide for the default template and use it as the base for every scene you create.  Add your content in the right place.  If the text in the guides and tutorials are not explaining to you where to put things, study the sample code and learn from there.

Rob

Hi

I have a published app in Google Playstore and now its giving me this error

in com.google.android.gms.internal.dw$h.b

and the following is in the console

java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$h.b(Unknown Source)
at com.google.android.gms.internal.dw$b.bR(Unknown Source)
at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)

how can this be resolved?

Did you test on a device before uploading?

no I had not tested on device maybe let me try it and give feedback

Rob, you’re an absolute lifesaver. Im Actually studying lua now, so i dont think ill be asking anymore questions from now on.

Once again your an absolute lifesaver for going through that process.