While I'm not 100% this is the cause of the bug, I'm quite certain that function references inside the Lua table of a Lua Entity get removed on unload/load of entities and are completely unreliable. Every time this function references get nil, Minetest crashes with a nil exception.
The proposed fix for this bug is to implement a execute function in actions.lua that takes a constant value and executes the corresponding function. These constants will be called "commands" and they are going to be defined in actions.lua. These commands are going to be stored in the queue of the Lua Entity instead of the direct function reference.
While I'm not 100% this is the cause of the bug, I'm quite certain that function references inside the Lua table of a Lua Entity get removed on unload/load of entities and are completely unreliable. Every time this function references get nil, Minetest crashes with a nil exception.
The proposed fix for this bug is to implement a
execute
function inactions.lua
that takes a constant value and executes the corresponding function. These constants will be called "commands" and they are going to be defined inactions.lua
. These commands are going to be stored in the queue of the Lua Entity instead of the direct function reference.