Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !-- allows things like 'for j in wesnoth.get_sides({{"has_unit",{race="orc"}}}) do wesnoth.message(j.gold) end '
- --! Returns an iterator over teams matching a given side filter that can be used in a for-in loop.
- function wesnoth.get_sides(cfg)
- local function f(s)
- local i = s.i
- local team
- repeat
- i = i + 1
- team = wesnoth.get_side(i)
- if not team then return nil end
- until wesnoth.match_side(i,cfg)
- s.i = i
- return team
- end
- return f, { i = 0 }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement