composer.getScene()

Type Function
Library composer.*
Return value Table
Revision 2017.3145
Keywords composer, scene, getScene

Overview

Returns the specified scene object, as returned from composer.newScene(). Returns nil if the scene object does not exist. This function is useful for getting a reference to a specific scene object — for instance, if the current scene needs access to a specific function that's attached to another scene.

Syntax

composer.getScene( sceneName )
sceneName (required)

String. The name of the scene object.

Example

local composer = require( "composer" )

-- Get a reference to "titleScene"
local titleScene = composer.getScene( "titleScene" )
 
-- Call the following function (defined in "titleScene.lua")
titleScene.getUserPrefs()