Pevernow / Witt-2

https://content.minetest.net/pevernow/witt
GNU General Public License v3.0
0 stars 1 forks source link

Crash on 5.4.1 when using /witt off #2

Open Montandalar opened 3 years ago

Montandalar commented 3 years ago

I assume this is some kind of deprecated API?

2021-11-19 03:08:43: WARNING[Server]: Undeclared global variable "blank_player_hud" accessed at /home/REDACTED/.minetest/mods/witt/init.lua:116
2021-11-19 03:08:43: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'witt' in callback on_chat_message(): /home/REDACTED/.minetest/mods/witt/init.lua:116: attempt to call global 'blank_player_hud' (a nil value)
2021-11-19 03:08:43: ERROR[Main]: stack traceback:
2021-11-19 03:08:43: ERROR[Main]:   /home/REDACTED/.minetest/mods/witt/init.lua:116: in function 'func'
2021-11-19 03:08:43: ERROR[Main]:   /usr/share/games/minetest/builtin/game/chat.lua:74: in function </usr/share/games/minetest/builtin/game/chat.lua:48>
2021-11-19 03:08:43: ERROR[Main]:   /usr/share/games/minetest/builtin/game/register.lua:422: in function </usr/share/games/minetest/builtin/game/register.lua:406>
JacobKotrla commented 2 years ago

The issue also occurs on older versions of Minetest. It's not a deprecated API in the engine, but a mistake in the conversion of blank_player_hud from a global function (bad practice I think) to a member of global variable Witt. Simply changing line 116 in init.lua from blank_player_hud(player) to Witt.blank_player_hud(player) fixes the issue.