in my mod i use this
Areastore.get_areas_in_area(edge1,edge2,true,true,true)
The description httto this API http://minetest.gitlab.io/minetest/class-reference/ i read that it returns a table with the ID of the areas.
but now (since update?) it returns a table with max,min,data of all areas but no ID.
is this a bug? or must i update my mod and chance the code?
-- the old way
local region_has_regions = rac.rac_store:get_areas_in_area(edge1,edge2,true,true,true)
if #region_has_regions == 1 then -- one Area is in the Area
-- es gibt eine Region
-- darf man hier claimen
-- the ID is in region_has_regions[1]
if rac:get_region_attribut(region_has_regions[1],"claimable") then -- prüfe ob claimable
....
Problem AreaStore.get_areas_in_area(edge1,edge2,true,true,true)
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Problem AreaStore.get_areas_in_area(edge1,edge2,true,true,true)
It's indexed by the id. Here's an example of the data:
Because the ids aren't consecutive, you can't use #. Instead, you'll need to use next:
Code: Select all
{
123 = { min = { x = 1, y = 2, z = 3 }, max = { x = 1, y = 2, z = 3 }, data = "" },
4444 = { min = { x = 1, y = 2, z = 3 }, max = { x = 1, y = 2, z = 3 }, data = "" },
3 = { min = { x = 1, y = 2, z = 3 }, max = { x = 1, y = 2, z = 3 }, data = "" },
}
Code: Select all
local region_has_regions = rac.rac_store:get_areas_in_area(edge1,edge2,true,true,true)
local first_id, first = next(region_has_regions)
local second_id, second = next(region_has_regions, first)
if first_id and not second_id then
-- Only has one value
end
Who is online
Users browsing this forum: No registered users and 3 guests