Skip to main content

Room.OnPlayerLeft

"Read-Only"

This property is Read-Only

NameType
OnPlayerLeftEventHandler

Event callback function requirement

info

This property is an event. It means that you need to add a listener function to it. Here how that function needs to look like.

function(MLPlayer player);

Parameters
NameTypeDescription
playerMLPlayerThe player who left.

Usage


--- callback function called when event triggers
--- @param mlplayer MLPlayer
local function CallBack(mlplayer)
-- code to handle event call back
end


-- Regsiter callback function
Room.OnPlayerLeft.Add(CallBack);

Description

Event handler that gets invoked when a player leaves the room.

Example

Will pass the player who left as argument.

do -- script RoomManager 

-- get reference to the script
local RoomManager = LUA.script;

local function OnPlayerJoin(player)
-- log the MLPlayer object passed in
Debug:Log(player);
end

-- start only called at beginning
function RoomManager.Start()
Room.OnPlayerLeft.Add(OnPlayerJoin);
end
end