From 8d4768813bb43df8d189da56c8431bd1e7f1f198 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Thu, 23 May 2024 22:27:18 +0200 Subject: [PATCH] feat(inferium-gui): add basic titleFn --- inferium-gui.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inferium-gui.lua b/inferium-gui.lua index 65b94ed..e779565 100644 --- a/inferium-gui.lua +++ b/inferium-gui.lua @@ -1,7 +1,20 @@ local CountersSelector = require('libs/ui/CountersSelector') +local counterMax = 8 + local config = { - counterMax = 8 + counterMax = counterMax, + titleFn = function(countersMap) + local total = 0; + + for _, counterPayload in pairs(countersMap) do + if counterPayload and counterPayload.count then + total = total + counterPayload.count + end + end + + return "| " .. total .. '/' .. counterMax .. ' used farmlands' .. " |" + end } local countersMap = {