Hey! i am kinda new to corona and “lua” code and i have taken the touorails but am confused as my code got this error and idk why
of course i tried to search it up but couldent find a thing if u can plz help
yes i am a newbie
error: Bad argument #1 to ‘find’ (string expected, got nil)
code:
local options = { effect = "fade", time = 800, } local button = display.newImage ("play\_button.png") button.x = 160 button.y = 330 button:scale( 5.0, 5.0) function button:tap( event ) composer.gotoScene( game , options) end button:addEventListener( "tap", object )
game should be in double quotes.
XeduR
September 26, 2018, 5:25pm
3
It’s exactly as nick said. Corona’s error messages are usually great at pointing out where the problem is and what causes the problem. In your case, the error message literally states that Corona expected the input to be in string format, i.e. “game”.
i did that and am getting the following error :mellow:
Attempt to concatenate global ‘sceneName’ (a nil value)
File: ?
Do you have a composer scene called game.lua?
sry as i said i am a newbie so idk what u mean but i do have a file called game.lua
but it is not linked in anyway to the composer
XeduR
September 27, 2018, 1:07am
7
When you are using composer to move from one scene to another, you need to include the necessary code in both files.
You can read about scene management at https://docs.coronalabs.com/guide/programming/04/index.html . You can also create a new project using the templates in Corona and you’ll see how the code works there.
game should be in double quotes.
XeduR
September 26, 2018, 5:25pm
9
It’s exactly as nick said. Corona’s error messages are usually great at pointing out where the problem is and what causes the problem. In your case, the error message literally states that Corona expected the input to be in string format, i.e. “game”.
i did that and am getting the following error :mellow:
Attempt to concatenate global ‘sceneName’ (a nil value)
File: ?
Do you have a composer scene called game.lua?
sry as i said i am a newbie so idk what u mean but i do have a file called game.lua
but it is not linked in anyway to the composer
XeduR
September 27, 2018, 1:07am
13
When you are using composer to move from one scene to another, you need to include the necessary code in both files.
You can read about scene management at https://docs.coronalabs.com/guide/programming/04/index.html . You can also create a new project using the templates in Corona and you’ll see how the code works there.