Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crashes with attempt to call method 'get_2d' (a nil value) #139

Closed
FinishedFragment opened this issue Nov 3, 2018 · 7 comments
Closed

Comments

@FinishedFragment
Copy link

While using the latest version on master I encountered some crashes while roaming the world (generated with Mapgen v7):

ERROR[Main]: ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'flowers' in callback environment_OnGenerated(): ....minetest/games/Lord-of-the-Test/mods/flowers/mapgen.lua:15: attempt to call method 'get_2d' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: 	....minetest/games/Lord-of-the-Test/mods/flowers/mapgen.lua:15: in function <....minetest/games/Lord-of-the-Test/mods/flowers/mapgen.lua:1>
ERROR[Main]: 	/usr/share/minetest/builtin/game/register.lua:420: in function </usr/share/minetest/builtin/game/register.lua:400>

and a similar one which happens more often:

ERROR[Main]: ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'lottmapgen' in callback environment_OnGenerated(): ...minetest/games/Lord-of-the-Test/mods/lottmapgen/init.lua:184: attempt to call method 'get_2d_map_flat' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: 	...minetest/games/Lord-of-the-Test/mods/lottmapgen/init.lua:184: in function <...minetest/games/Lord-of-the-Test/mods/lottmapgen/init.lua:110>
ERROR[Main]: 	/usr/share/minetest/builtin/game/register.lua:420: in function </usr/share/minetest/builtin/game/register.lua:400>

Minetest version 0.4.17.1

@FinishedFragment
Copy link
Author

If a singlenode world is generated, the subgame will crash instantly with one of the above errors (seems random to me). I tested this with a few, freshly generated worlds.
Also, in a 'normal' world (mapgen v7) being near or entering a angmar biome causes more crashes in my case.

@peternowee
Copy link

Same here, also on Minetest 0.4.17.1. On entering newly generated worlds, the character selection dialog briefly shows up, but then the entire screen turns grey and Minetest becomes unresponsive.

I checked with previous commits and found the problem to be caused by the most recent commit: 2e376bd, PR #134, which replaced some deprecated functions in preparation for Minetest v5. The error messages also mention the new function names (get_2d and get_2d_map_flat) introduced by that commit.

@FinishedFragment
Copy link
Author

Can confirm, can't generate new worlds with LOTT, just tested it

@neinwhal
Copy link
Member

get_2d and get_2d_map_flat are functions that only work in Minetest-0.5.0-dev, so it will crash in any older versions.
But that isn't suppose to be the case, this master branch is suppose to still remain compatible for older minetest versions, I'll revert any 0.5.0-dev specific changes.

@Amaz1
Copy link
Member

Amaz1 commented Mar 24, 2019

Minetest 5.0.0 has been released, so I guess this is invalid now. Let me know if I need to actually do anything with LOTT to fix it, but 0.4.16/17 are no longer supported!

@Amaz1 Amaz1 closed this as completed Mar 24, 2019
@FinishedFragment
Copy link
Author

@Amaz1 tested with Minetest 5.0.0. Still happens:

ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'lottmapgen' in callback environment_OnGenerated(): ...minetest/games/Lord-of-the-Test/mods/lottmapgen/functions.lua:941: attempt to compare nil with numbe
stack traceback:
	...minetest/games/Lord-of-the-Test/mods/lottmapgen/functions.lua:941: in function 'lottmapgen_biomes'
	...minetest/games/Lord-of-the-Test/mods/lottmapgen/init.lua:222: in function <...minetest/games/Lord-of-the-Test/mods/lottmapgen/init.lua:110>
	/usr/share/minetest/builtin/game/register.lua:419: in function </usr/share/minetest/builtin/game/register.lua:399>

@Amaz1
Copy link
Member

Amaz1 commented Apr 2, 2019

@FinishedFragment I think that is to do with the issue you describe in #140, not the get_2d etc., as that should all work in MT 5.0.0, and the error you just posted is more akin to the one found in the other issue, rather than the ones you posted here before.

mckaygerhard added a commit to minenux/minetest-mod-tsm_pyramids that referenced this issue Apr 29, 2024
…test

* i was first checked at https://forum.minetest.net/viewtopic.php?t=8157
  as "minetest.get_perlin() and minetest.get_perlin_map() Return nil" by prestidigitator
  The `minetest.get_perlin()` function returns nil since 0.4.8+ until 5.1.0
  The `PerlinNoise()` constructor does return a valid object, on the other hand,
  barely documented as alternatrive cos is internally used only and not api public
  cos can only call it after the environment is created, so the code
  must bne inside `minetest.after(0, ...)` it only works the first time,
  or must be used an alternative
* was reported also minetest/minetest#10385 that
  does not properly handle large world seeds
* Close https://codeberg.org/Wuzzy/minetest_tsm_pyramids/issues/2
* Close https://codeberg.org/minetest-stuffs/minetest-mod-tsm_pyramids/issues/2
* Also uses older get2d vs get_2d for newer engines older pre 5.0.0
  as seen on minetest-LOTR/Lord-of-the-Test#139
  detect newer engine and uses proper method to get agains perlin object
  Closes https://codeberg.org/minetest-stuffs/minetest-mod-tsm_pyramids/issues/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants