From 54436d562ffe59d04ae0925e9b592db8b9aa5622 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Mon, 27 May 2024 23:52:29 +0200 Subject: [PATCH] your-land/yl_announcements#1 Announcement removes itself after expiry --- globalsteps.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/globalsteps.lua b/globalsteps.lua index 4d18ff2..34b89b9 100644 --- a/globalsteps.lua +++ b/globalsteps.lua @@ -51,7 +51,11 @@ local gs = function(dtime) -- Check if any announcement should be displayed for _, announcement in pairs(data) do - if current_time >= (announcement.next_runtime or 0) then -- announcement.next_runtime exists + -- Check if any announcement needs to be removed from the list due to runtime expired. + if ((type(announcement.runtime) == "number") and + (current_time >= (announcement.creation_date + announcement.runtime))) then + yl_announcements.delete(announcement.id) + elseif current_time >= (announcement.next_runtime or 0) then if (type(announcement.next_runtime) ~= "number") then table.insert(affected_bucket, announcement.frequency)