From 89914888d7dd801fb8430aeb386fd423e0f86f46 Mon Sep 17 00:00:00 2001 From: Yagiz ALP Date: Mon, 20 Jul 2020 17:21:46 +0300 Subject: [PATCH] Code cleanup (#2) --- server/main.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/server/main.lua b/server/main.lua index 2896732e..6dc7f8ed 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,25 +1,21 @@ -local Jobs = {} +local Jobs = {} local LastTime = nil function RunAt(h, m, cb) - table.insert(Jobs, { h = h, m = m, cb = cb }) - end function GetTime() - local timestamp = os.time() - local d = os.date('*t', timestamp).wday - local h = tonumber(os.date('%H', timestamp)) - local m = tonumber(os.date('%M', timestamp)) + local d = os.date('*t', timestamp).wday + local h = tonumber(os.date('%H', timestamp)) + local m = tonumber(os.date('%M', timestamp)) return {d = d, h = h, m = m} - end function OnTime(d, h, m) @@ -29,11 +25,9 @@ function OnTime(d, h, m) Jobs[i].cb(d, h, m) end end - end function Tick() - local time = GetTime() if time.h ~= LastTime.h or time.m ~= LastTime.m then