Something weird about moveresult.collisions

Post Reply
User avatar
Posts: 387
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

Something weird about moveresult.collisions

by davidthecreator » Post

I tried to use moveresult.collisions.type to check if an object is colliding with a node or other object, but it wouldn't work... Untill I used a minetest.serialize() trick to check what the full table looks like and noticed that it's properties are stored in double table brackets {{ }}
While hpchange for example, uses single table brackets {}, so the feature that I need, only works if I write it like:


And having to use [1] seems a little weird, considering it seems to be the only element in "collisions" table aniway...

So is it intentional, or will it be changed in near future?

Posts: 400
Joined: Sun Dec 16, 2018 12:50

Re: Something weird about moveresult.collisions

by Termos » Post

It only happens to be the only element most of the time, but occasionally there can be up to three elements (one for each axis) and theoretically even more when bouncy nodes are involved.
Yes this is intentional.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests