I just got a crash from not understanding how this event fully works. Specifically, could this be added to the documentation for “player_index” in “on_player_banned”
“Index of the banned LuaPlayer. Is nil if the banned username isn’t tied to a player that ever joined the game.”
My own lack of experience with multiplayer led me to not know that it would be possible to ban a player who isn’t currently logged into the world. In my case, the user misspelled the user name.
on_player_banned nil player_index
-
Loup&Snoop
- Long Handed Inserter

- Posts: 63
- Joined: Wed Dec 04, 2024 4:33 am
- Contact:
Re: on_player_banned nil player_index
The event documentation already specifies the player_index as optional, if that was missed - would an extra comment about one of the ways it might not be provided be useful?
I’ve found when comments like that exist, people take them to mean “this is the *only* time this happens” when that isn’t guaranteed.
I’ve found when comments like that exist, people take them to mean “this is the *only* time this happens” when that isn’t guaranteed.
If you want to get ahold of me I'm almost always on Discord.
-
Loup&Snoop
- Long Handed Inserter

- Posts: 63
- Joined: Wed Dec 04, 2024 4:33 am
- Contact:
Re: on_player_banned nil player_index
The main thing is: Since I don’t play multiplayer, I did not understand in what situation it could even be nil.
I can put in my own nil checks since it is listed as int or nil. But I still wouldn’t know what situations are getting caught in that nil check.
It may make sense to specify in the main event documentation (instead of the doc for the field) that “Players are banned by name (string), so there may be no matching LuaPlayer.” Or something like that. From this, I can reasonably infer the cases of misspelling or banning someone who never joined the game.
I can put in my own nil checks since it is listed as int or nil. But I still wouldn’t know what situations are getting caught in that nil check.
It may make sense to specify in the main event documentation (instead of the doc for the field) that “Players are banned by name (string), so there may be no matching LuaPlayer.” Or something like that. From this, I can reasonably infer the cases of misspelling or banning someone who never joined the game.
Re: on_player_banned nil player_index
I imagine that if it's worded like "for example..." then people will not assume that the examples shown are an exhaustive list of possible scenarios (at least I feel like it's very unambiguous).Rseding91 wrote: Wed Oct 29, 2025 10:19 pm I’ve found when comments like that exist, people take them to mean “this is the *only* time this happens” when that isn’t guaranteed.
Re: on_player_banned nil player_index
If the player doesn't exist in the save is one case. What are the others? Seems to me there can't be that many.Rseding91 wrote: Wed Oct 29, 2025 10:19 pm The event documentation already specifies the player_index as optional, if that was missed - would an extra comment about one of the ways it might not be provided be useful?
I’ve found when comments like that exist, people take them to mean “this is the *only* time this happens” when that isn’t guaranteed.
That's a docs request, not an API request.Loup&Snoop wrote: Thu Oct 30, 2025 1:42 am The main thing is: Since I don’t play multiplayer, I did not understand in what situation it could even be nil.
I can put in my own nil checks since it is listed as int or nil. But I still wouldn’t know what situations are getting caught in that nil check.
It may make sense to specify in the main event documentation (instead of the doc for the field) that “Players are banned by name (string), so there may be no matching LuaPlayer.” Or something like that. From this, I can reasonably infer the cases of misspelling or banning someone who never joined the game.
-
Loup&Snoop
- Long Handed Inserter

- Posts: 63
- Joined: Wed Dec 04, 2024 4:33 am
- Contact:
Re: on_player_banned nil player_index
My mistake. I intended to post this in the API documentation request forum. I only noticed when Curiosity mentioned.
Could a moderator help me out by moving this thread to the doc request forum? EDIT: ty, mod

