The .
The .
is an operator that gives access to data contained within a table. The data contained within a table can be a variable or a function (these are often referred to as the “properties” of the table.)
The following program uses the PostProcess module to skew the color of the game to make it look like night time.
function changeBackground(player)
PostProcess.setColorAdjustments(player.id, 0, {180,180,180}, nil, -100)
end
function onSensorEnter(object)
if object.isPlayer == true then
changeBackground(object)
end
end
When the above program runs:
- The global event function
onSensorEnter()
is called by SuperCode whenever an object enters the sensor, and is passed the variableobject
(which is the object that entered the sensor). - When
onSensorEnter()
is called, it calls thechangeBackground()
function, passing the variableobject
to it. - When the
changeBackground()
function runs, it is passed the variableobject
, which is then assigned to the variableplayer
. - The
changeBackground()
function then the passes theid
property from theplayer
variable (i.e.player.id
) as an input to call thePostProcess.setColorAdjustments()
function.