composer.setVariable()

Type Function
Library composer.*
Return value none
Revision Release 2022.3683
Keywords composer, scene, setVariable
See also composer.getVariable()

Overview

This function sets a variable within the Composer module which you can access from any other scene via composer.getVariable().

Syntax

composer.setVariable( variableName, value )
variableName

String. The name of the variable to set.

value

String. The value to assign to the variable.

Example

-- Set the Composer variable "money" to 100
composer.setVariable( "money", 100 )

-- In another scene...
local currentMoney = composer.getVariable( "money" )