Type Table Event create Revision Release 2024.3703 Keywords composer, scene, create, event
If the params
option was specified when calling composer.gotoScene(), composer.showOverlay(), or composer.loadScene(), the same value will be passed to event.params
so it can be accessed by create and show event listeners for the scene that is being loaded.
If the params
option was omitted when calling these functions, the value of event.params
will be nil
.
-------------------------- -- From "scene1.lua" -------------------------- local customParams = { var1 = "Hello ", var2 = "World!" } composer.gotoScene( "scene2", { effect="fade", time=800, params=customParams } ) -------------------------- -- In "scene2.lua" -------------------------- local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) print( event.params.var1 .. event.params.var2 ) end scene:addEventListener( "create" )