More functions for engine.Level.spots?
Posted: Wed Aug 04, 2010 6:53 pm
I am starting to use the addSpots function in engine.generators.maps.Static quite a bit, and I know that all map generators are expected to return spots which is then put into the level table (engine.Zone line 522-529). Do you think it would be worth adding spots and some helper functions to engine.Level at initialization time? The specific function I had in mind is for filtering:
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