Lua GetPlayers

GetPlayers
Returns all valid players currently loaded by the client as LuaPlayer objects.

NOTE: This function returns a C# List<?> that has not been marshalled. It is recommended that you marshal the results into a Lua table using the provided toTable function, as shown in the example below.

NOTE: It is possible for a player returned by this function to no longer be valid. If needed, you should verify that by checking IsValid.

Example
-- The result of GetPlayers is marshalled to Lua using our toTable function. local players = toTable(GetPlayers);

-- Loop all players and print their names to the log. for k, v in pairs(players) do Info("Player at index " .. k .. " is named " .. v.Name); end