mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 03:57:17 +00:00
modified iterator function helper.get_sides...
...to return wesnoth.sides[side_number], side_number TBH, I dont't fully understand the syntax, especially the one before this, and it seems silene did experiment with it too...but this works now at least.
This commit is contained in:
parent
786fcbfd1f
commit
c1d8858c90
@ -4,14 +4,17 @@ local helper = {}
|
||||
|
||||
--! Returns an iterator over all the sides matching a given filter that can be used in a for-in loop.
|
||||
function helper.get_sides(cfg)
|
||||
local function f(dummy, i)
|
||||
local function f(s)
|
||||
local i = s.i
|
||||
while i < #wesnoth.sides do
|
||||
i = i + 1
|
||||
if wesnoth.match_side(i, cfg) then return i end
|
||||
if wesnoth.match_side(i, cfg) then
|
||||
s.i = i
|
||||
return wesnoth.sides[i], i
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
return f, nil, 0
|
||||
return f, { i = 0 }
|
||||
end
|
||||
|
||||
--! Interrupts the current execution and displays a chat message that looks like a WML error.
|
||||
|
Loading…
x
Reference in New Issue
Block a user