Hello Ritn,
Thanks for your bug report.
You made a change in a "low level" function named rmButtons
. I made a similar fix on the calling function manageButtons
(to avoid the same issue when we create the buttons).
-- create or hide buttons (per user) --
local function manageButtons(player_index)
+ -- avoid strange case where player_index is nil
+ if not player_index then return end
Your issue should be fixed now.
Released in 17.5.0 and 18.5.0.
For your information, if you are insterested by improving your Lua skill,
there is a logic issue in you code...
When you use "pcall" it really execute the lua code.
The "ok" variable is only here to tell you if everything was good or bad.
Your code inside the "if ok " code block is duplicated. The job was already done in the function call by pcall
.
If you just want to run a code and ignore any error, you can simply do (without any ok variable):
pcall(function()
THE_CODE_HERE
end)
If you want to catch the error to send a warning message
local ok = pcall(function()
THE_CODE_HERE
end)
if not ok then
WARNING_CODE_HERE
end
Have fun!