@robmiracle–for the last pass 2 hrs I have been fixing code, which is a good thing because I am learning. I fix one error and another one appeared. I now have one that I have no idea how to address it:
Runtime error
?:0: attempt to concatenate global ‘sceneName’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘gotoScene’
…Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:22: in function ‘onRelease’
?: in function <?:191>
?: in function <?:226>
Runtime error
?:0: attempt to index a boolean value
stack traceback:
[C]: ?
?: in function ‘reloadScene’
?: in function ‘gotoScene’
…Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:22: in function ‘onRelease’
?: in function <?:191>
?: in function <?:226>
[import]uid: 69302 topic_id: 30033 reply_id: 120785[/import]
can you post your latest menu.lua?
[import]uid: 19626 topic_id: 30033 reply_id: 120786[/import]
[code]-----------------------------------------------------------------------------------------
– menu.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– include Corona’s “widget” library
local widget = require “widget”
– forward declarations and other locals
local playBtn
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
– go to level1.lua scene
storyboard.gotoScene( “level1”, “fade”, 500 )
return true – indicates successful touch
end
– BEGINNING OF YOUR IMPLEMENTATION
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– display a background image
–local background = display.newImageRect( “background.jpg”, display.contentWidth, display.contentHeight )
–background:setReferencePoint( display.TopLeftReferencePoint )
–background.x, background.y = 0, 0
– create/position logo/title image on upper-half of the screen
–local titleLogo = display.newImageRect( “logo.png”, 264, 42 )
–titleLogo:setReferencePoint( display.CenterReferencePoint )
–titleLogo.x = display.contentWidth * 0.5
–titleLogo.y = 100
– create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
label=“test”,
labelColor = { default={255}, over={128} },
default=“button.png”,
over=“button-over.png”,
width=160, height=40,
onRelease = onPlayBtnRelease – event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 125
– all display objects must be inserted into group
–group:insert( background )
–group:insert( titleLogo )
group:insert( playBtn )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– 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 )
local group = self.view
– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
if playBtn then
playBtn:removeSelf() – widgets must be manually removed
playBtn = nil
end
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 whenever 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
[/code] [import]uid: 69302 topic_id: 30033 reply_id: 120787[/import]
It’s probably the space between native and .systemFont on line 41 [import]uid: 19626 topic_id: 30033 reply_id: 120273[/import]
Thanks robmiracle, but that didn’t fix the error. so it must be something else just not sure what though. [import]uid: 69302 topic_id: 30033 reply_id: 120297[/import]
Some please tell me what this mean please :
attempt to concatenate global ‘sceneName’ (a nil value) [import]uid: 69302 topic_id: 30033 reply_id: 120997[/import]
Can you do me a favor and remove the:
, “fade”, 500
from the gotoScene call? In other words change the line to:
storyboard.gotoScene( "level1" )
[import]uid: 19626 topic_id: 30033 reply_id: 121018[/import]
If you repost your code putting it inside of <code> and </code> tags, it will give us line numbers to look at which will help a lot. [import]uid: 19626 topic_id: 30033 reply_id: 120323[/import]
Hello robmiracle,
Im sorry but I am new, how to I repost it inside the code/tags. I know what you mean just not sure how to do it. Do you mind explaining? [import]uid: 69302 topic_id: 30033 reply_id: 120324[/import]
Once I did that the same error came back up:
Runtime error
?:0: attempt to concatenate global ‘sceneName’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘gotoScene’
…Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:22: in function ‘onRelease’
?: in function <?:191>
?: in function <?:226>
Runtime error
?:0: attempt to index a boolean value
stack traceback:
[C]: ?
?: in function ‘reloadScene’
?: in function ‘gotoScene’
…Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:22: in function ‘onRelease’
?: in function <?:191>
?: in function <?:226>
[import]uid: 69302 topic_id: 30033 reply_id: 121021[/import]
hah, this thread is daunting
if you upload your assets, i’ll fix the whole thing [import]uid: 98393 topic_id: 30033 reply_id: 121023[/import]
lol who are you telling. But with the help of robmiracle I have over come a lot of errors.
But what do you mean but upload my assests? lol [import]uid: 69302 topic_id: 30033 reply_id: 121026[/import]
type in < code > (leave out the spaces)
paste your code
type in < / code > (again leave out the spaces)
It will retain any indention in your code, provide line numbers, etc. which will make it easier for us to read your code.
[import]uid: 19626 topic_id: 30033 reply_id: 120331[/import]
I mean the whole folder as a .zip
It’s easier to fix as I can easily open it in Corona. [import]uid: 98393 topic_id: 30033 reply_id: 121028[/import]
Thats what I thought but I wasn’t certain. Will it allow me to post a zip file? because I tried to post a file for peachpellen and I had to email it to her. [import]uid: 69302 topic_id: 30033 reply_id: 121032[/import]
How should I send you the zip file so that you can help me fix this ongoing headache? [import]uid: 69302 topic_id: 30033 reply_id: 121035[/import]
You can either email it, or use something like DropBox to share it.
And just to make sure… Your level1.lua is really called leve1.lua (same capitalization).
I think I’m with Paul_G, its time to see your whole project. The code you posted above doesn’t seem to have any obvious errors, though other things could be causing it.
[import]uid: 19626 topic_id: 30033 reply_id: 121038[/import]
[code] -----------------------------------------------------------------------------------------
– level1.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– include Corona’s “physics” library
–local physics = require “physics”
–physics.start(); physics.pause()
– forward declarations and other locals
–local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth*0.5
– BEGINNING OF YOUR IMPLEMENTATION
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– create a grey rectangle as the backdrop
local background = display.newRect( 0, 0, screenW, screenH )
background:setFillColor( 255 )
–_W = display.viewableContentWidth
–_H = dislay.viewableContentHeight
–local background = display.newRect(0, 0, _W, _H)
–background:setFillColor (255, 255, 255);
local font = “HelveticaNeue” or native .systemFont;
local label =display.newText(“Tap here to send a text”, 0, 0, font, 18) ;
label:setReferncePoint(display.CenterReferencePoint) ;
label:setTextColor(0, 0, 0) ;
label.x = _W * 0.5;
label.y = _H – 50;
function label:tap(e)
native.showPopup(“sms”,{
body = “I sent this text from my app”,
to = {5550000000”}
}) ;
end
label:addEventListner(“tap”, label);
– 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 whenever 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
[/code] [import]uid: 69302 topic_id: 30033 reply_id: 120343[/import]
Just tell me where to send it and I will sent it. email/dropbox its getting to a point of frustation. I designed and interactive program for class and that wasn’t this difficult. [import]uid: 69302 topic_id: 30033 reply_id: 121039[/import]
and here is the main.lua thank you for showing me this. Im learning something new each time.
[code] -----------------------------------------------------------------------------------------
– menu.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– include Corona’s “widget” library
local widget = require “widget”
– forward declarations and other locals
local playBtn
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
– go to level1.lua scene
storyboard.gotoScene( “level1”, “fade”, 500 )
return true – indicates successful touch
end
– BEGINNING OF YOUR IMPLEMENTATION
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– display a background image
–local background = display.newImageRect( “background.jpg”, display.contentWidth, display.contentHeight )
–background:setReferencePoint( display.TopLeftReferencePoint )
–background.x, background.y = 0, 0
– create/position logo/title image on upper-half of the screen
–local titleLogo = display.newImageRect( “logo.png”, 264, 42 )
–titleLogo:setReferencePoint( display.CenterReferencePoint )
–titleLogo.x = display.contentWidth * 0.5
–titleLogo.y = 100
– create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
label=“test”,
labelColor = { default={255}, over={128} },
default=“button.png”,
over=“button-over.png”,
width=160, height=40,
onRelease = onPlayBtnRelease – event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 125
– all display objects must be inserted into group
–group:insert( background )
–group:insert( titleLogo )
group:insert( playBtn )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– 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 )
local group = self.view
– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
if playBtn then
playBtn:removeSelf() – widgets must be manually removed
playBtn = nil
end
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 whenever 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
[/code] [import]uid: 69302 topic_id: 30033 reply_id: 120344[/import]