Page 1 of 1

Mushroom mod bug...

PostPosted: Thu Jan 19, 2012 21:14
by redcrab
I've got several crash due to mushroom mod lua error.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
20:33:18: ERROR[ServerThread]: ERROR: An unhandled exception occurred: LuaError: error: ...netest-Appliance/bin/../data/mods/mushrooms/init.lua:238: attempt to compare number with nil
20:33:18: ERROR[ServerThread]: stack traceback:

In thread b69ffb70:
Minetest-Appliance/src/server.cpp:115: virtual void* ServerThread::Thread(): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD b69ffb70:
#0  virtual void* ServerThread::Thread()
(Leftover data: #1  void Server::AsyncRunStep())
(Leftover data: #2  virtual void ServerEnvironment::step(float))
(Leftover data: #3  void RemoteClient::GetNextBlocks(Server*, float, irr::core::array<PrioritySortedBlockTransfer>&))
(Leftover data: #4  void BlockEmergeQueue::addBlock(irr::u16, v3s16, irr::u8))
DEBUG STACK FOR THREAD b750b6d0:
#0  int main(int, char**)
#1  void dedicated_server_loop(Server&, bool&)
(Leftover data: #2  irr::core::list<PlayerInfo> Server::getPlayerInfo())



So ... what's up ...

PostPosted: Thu Jan 19, 2012 22:48
by randomproof
My guess is that line 204: "local l_above = minetest.env:get_node_light({x = pos.x,y=pos.y+2,z=pos.z}, nil)" is returning nil because that pos wasn't generated or loaded from disk yet.

It should be noted that any of the minetest.env functions could return nil for unloaded mapblocks. For most mods you don't need to worry about it, but it is possible and should be checked for. Of course, I say that knowing I haven't.

PostPosted: Fri Jan 20, 2012 09:33
by Hackeridze
randomproof wrote:My guess is that line 204: "local l_above = minetest.env:get_node_light({x = pos.x,y=pos.y+2,z=pos.z}, nil)" is returning nil because that pos wasn't generated or loaded from disk yet.

It should be noted that any of the minetest.env functions could return nil for unloaded mapblocks. For most mods you don't need to worry about it, but it is possible and should be checked for. Of course, I say that knowing I haven't.

Okay, I'm busy for now(a lot of work), but I will fix it in some weeks or apply the patch if somebody do that. Also problems about mod should be posted in %modname% thread.

PostPosted: Fri Jan 20, 2012 19:55
by redcrab
Hackeridze wrote:
randomproof wrote:My guess is that line 204: "local l_above = minetest.env:get_node_light({x = pos.x,y=pos.y+2,z=pos.z}, nil)" is returning nil because that pos wasn't generated or loaded from disk yet.

It should be noted that any of the minetest.env functions could return nil for unloaded mapblocks. For most mods you don't need to worry about it, but it is possible and should be checked for. Of course, I say that knowing I haven't.

Okay, I'm busy for now(a lot of work), but I will fix it in some weeks or apply the patch if somebody do that. Also problems about mod should be posted in %modname% thread.


I tried to fix it ... here my update into mushroom/init.lua file
just be sure to test for nil value .. line 220 and 238
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
220c220
<                 elseif (l and l >= NEEDED_LIGHT)then
---
>                 elseif (l >= NEEDED_LIGHT)then
238c238
<                 elseif (l_above and l_above >= NEEDED_LIGHT)then
---
>                 elseif (l_above >= NEEDED_LIGHT)then


until know ... no crash ... wait and see :)