Event
peer:nickname:change
ClientFired when the player nickname is changed
Signal
"peer:nickname:change"Arguments
| Type | Name | Description |
|---|---|---|
string | old_name | Username before the change |
string | new_name | Username after the change |
This signal is only fired on the client.
- Both arguments are the effective username, an empty nickname resolves to the operating system username.
- It is not fired when the resulting username stays the same, for example when only surrounding whitespace changes.
- It is not fired for the nickname loaded from the saved settings when the client starts, use
core.engine.get_nicknameto read the initial value.
Example
util.event.on("peer:nickname:change", function(old_name, new_name)
core.engine.print("info", "Nickname changed:", old_name, "->", new_name)
end)local player_name = core.engine.get_nickname()
util.event.on("peer:nickname:change", function(_, new_name)
player_name = new_name
end)