Module:BiomeDetails

From Eco - English Wiki
Revision as of 13:53, 5 May 2024 by Avaren (talk | contribs) (Created page with "local p = {} local Utils = require('Module:Utils') function p.listBiomes(frame) local args = Utils.normaliseArgs(frame) return p.renderBiomeList(args.type) end function p.renderBiomeList(biomeType, includeSubBiomes) local biomeData = require( "Module:BiomeData" ) local isLand = nil if biomeType == 'Land' then isLand = true elseif biomeType == 'Water' then isLand = false end local biomes = {} for bid, biome in pa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

local Utils = require('Module:Utils')

function p.listBiomes(frame)
    local args = Utils.normaliseArgs(frame)
    return p.renderBiomeList(args.type)
end

function p.renderBiomeList(biomeType, includeSubBiomes)
    local biomeData = require( "Module:BiomeData" )
    local isLand = nil
    if biomeType == 'Land' then
        isLand = true
    elseif biomeType == 'Water' then
        isLand = false
    end
    
    local biomes = {}
    for bid, biome in pairs(biomeData) do
        if biome.Name ~= '' and (isLand == nil or biome.Land == isLand) and (includeSubBiomes ~= true or biome.MainBiome == '') then
            biomes[#biomes+1] = "* [[" .. biome.Name .."]]"
        end
    end
    table.sort(biomes)

    return table.concat(biomes, "\n")
end

return p