This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Creating a script that use a database or array
#8
(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,
Reply


Messages In This Thread
RE: Creating a script that use a database or array - by khalil - 09.11.2021, 08:10

Forum Jump: