09.11.2021, 08:10
(08.11.2021, 13:19)admin Wrote: Scheduled script that runs every minute. Fill schedule table with dates and times.
Code:schedule = { ['1/1'] = { '1:05', '2:10' }, -- ... ['12/31'] = { '1:11', '15:13' }, } dtbl = os.date('*t') date = string.format('%d/%d', dtbl.month, dtbl.day) time = string.format('%d:%02d', dtbl.hour, dtbl.min) schedtimes = schedule[ date ] or {} for _, schedtime in ipairs(schedtimes) do if schedtime == time then -- execute action end end
Hello Admin,
the Array will be defined every time the script Run? if yes how to define it once not run every cycle?
regards
Best Regards,