Code: Select all
function _M:getSpots(type, subtype)
    if not type and not subtype then return self.spots end
    local matched = {}
    for i, v in pairs(self.spots) do
        if (not type or type and v.type == type) and (not subtype or subtype and v.subtype == subtype) then
            table.insert(matched, v)
        end
    end
    return matched
end