Private
Public Access
1
0
Files
lua-prometheus-exporter/pollution-stats.lua
Jan Grießhaber 149b085cb7 Initial Commit
2025-12-28 18:48:24 +01:00

18 lines
845 B
Lua

function GetPollutionStats()
for _,surface in pairs(game.surfaces) do
local surface_name = surface.name
local pollutionParts = {}
local pollution_stats = game.surfaces[surface_name].pollution_statistics
local pollution_input = pollution_stats.input_counts
local pollution_output = pollution_stats.output_counts
pollutionParts[#pollutionParts+1] = ("---pollution-input---%s\n"):format(surface_name)
for name, stat in pairs(pollution_input) do
pollutionParts[#pollutionParts+1] = ("%s:%d"):format(name, stat)
end
pollutionParts[#pollutionParts+1] = ("---pollution-output---%s\n"):format(surface_name)
for name, stat in pairs(pollution_output) do
pollutionParts[#pollutionParts+1] = ("%s:%d"):format(name, stat)
end
helpers.send_udp(52555, table.concat(pollutionParts,"\n"),1)
end
end