Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved] What does Team:GetPlayers() return if there are no players on that team?

Asked by 6 years ago
Edited 6 years ago

What does Team:GetPlayers() return if there are no players on that team? I thought it would return nil, but it didn't seem to.

Solved with BlueTaslem's answer.

the code I used:

if next(game.Teams["Blue"]:GetPlayers()) == nil then
1
An empty array. UgOsMiLy 1074 — 6y
0
Okay, thank you. pick1ehead 53 — 6y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
6 years ago

The Wiki says it returns a list, so it will return a list. The list will just be empty.

Not all nothings are equal. It would be very inconsistent to return nil when an empty list {} perfectly represents the concept of "a list containing nothing".

0
Ohhh, yeah. Thank you! pick1ehead 53 — 6y
Ad

Answer this question