Initial Commit
This commit is contained in:
56
production-stats.lua
Normal file
56
production-stats.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
---@param productionStatsTable LuaFlowStatistics
|
||||
---@param surface LuaSurface
|
||||
---@return string
|
||||
function CreateItemStatisticsString(productionStatsTable --[[LuaFlowStatistics]], surface --[[LuaSurface]])
|
||||
local parts = {}
|
||||
parts[#parts+1] = surface.name
|
||||
parts[#parts+1] = "---input---"
|
||||
for itemName, itemCount in pairs(productionStatsTable.input_counts) do
|
||||
parts[#parts+1] = itemName .. ":" .. itemCount
|
||||
end
|
||||
parts[#parts+1] = "---output---"
|
||||
for itemName, itemCount in pairs(productionStatsTable.output_counts) do
|
||||
parts[#parts+1] = itemName .. ":" .. itemCount
|
||||
end
|
||||
parts[#parts+1] = surface.name
|
||||
return table.concat(parts, "\n")
|
||||
end
|
||||
|
||||
|
||||
---comment
|
||||
---@param fluidStatsTable LuaFlowStatistics
|
||||
---@param surface LuaSurface
|
||||
---@return string
|
||||
function CreateFluidStatisticsString(fluidStatsTable --[[LuaFlowStatistics]], surface --[[LuaSurface]])
|
||||
local parts = {}
|
||||
parts[#parts+1] = surface.name
|
||||
parts[#parts+1] = "---input---"
|
||||
for fluidName, fluidCount in pairs(fluidStatsTable.input_counts) do
|
||||
parts[#parts+1] = fluidName .. ":" .. fluidCount
|
||||
end
|
||||
parts[#parts+1] = "---output---"
|
||||
for fluidName, fluidCount in pairs(fluidStatsTable.output_counts) do
|
||||
parts[#parts+1] = fluidName .. ":" .. fluidCount
|
||||
end
|
||||
parts[#parts+1] = surface.name
|
||||
return table.concat(parts, "\n")
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param deathStatsTable LuaFlowStatistics
|
||||
---@param surface LuaSurface
|
||||
---@return string
|
||||
function CreateDeathStatisticsString(deathStatsTable --[[LuaFlowStatistics]], surface --[[LuaSurface]])
|
||||
local parts = {}
|
||||
parts[#parts+1] = surface.name.."{"
|
||||
parts[#parts+1] = "---input---"
|
||||
for name, count in pairs(deathStatsTable.input_counts) do
|
||||
parts[#parts+1] = name .. ":" .. count
|
||||
end
|
||||
parts[#parts+1] = "---output---"
|
||||
for name, count in pairs(deathStatsTable.output_counts) do
|
||||
parts[#parts+1] = name .. ":" .. count
|
||||
end
|
||||
parts[#parts+1] = surface.name
|
||||
return table.concat(parts, "\n")
|
||||
end
|
||||
Reference in New Issue
Block a user