commit 3dcb106f490933f63d3d5f2d040084d3bdb36228
parent 4e4801458dc11e9c8e0768e90c0a445b9b1bc9ff
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Mon, 16 Oct 2023 10:32:22 -0300
Fix renaming issue in registration
When the new name is the same as the last, the player entry was being
overwritten with nil.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/registration.lua b/lib/registration.lua
@@ -53,8 +53,10 @@ function _M.register(args, players, log, ts)
end
if exists then
if yn(string.format("Player exists under name '%s'. Proceed? [yn] ", exists)) and not args.p then
- players[args.name] = players[exists]
- players[exists] = nil
+ if args.name ~= exists then
+ players[args.name] = players[exists]
+ players[exists] = nil
+ end
end
else
players[args.name] = {}