z_mirror/PipeVisualizer

git clone https://git.raiguard.me/z_mirror/PipeVisualizer

Caleb HeuerStore pipe connections in global, split and clean up code9371b54

2.0
607 B26 linesraw
1local util = {}
2
3--- Iterates the fluid system IDs of the given fluidbox.
4--- @param fluidbox LuaFluidBox
5--- @return fun(): uint?, FluidSystemID?
6function util.iterate_fluid_systems(fluidbox)
7  --- @type uint
8  local fluidbox_index = 0
9  --- @type uint
10  local limit = #fluidbox
11  local get_id = fluidbox.get_fluid_system_id
12  return function()
13    --- @type FluidSystemID
14    local id
15    while not id do
16      if fluidbox_index == limit then
17        return
18      end
19      fluidbox_index = fluidbox_index + 1
20      id = get_id(fluidbox_index)
21    end
22    return fluidbox_index, id
23  end
24end
25
26return util