Hello, I have an error that I can not solve I tried in several ways here is the simple script and the error if someone could tell me or I'm wrong thank you in advance
commandArray = {}
time = os.date("%H","%M")
local day=os.date("%A")
-- Déclenchement tous les jours à 0:02
if (heure == '17:17') and (day == 'thu') then
commandArray['SAM']='On'
end
return commandArray
Hydci wrote: ↑Thursday 31 October 2019 17:31
Hello, I have an error that I can not solve I tried in several ways here is the simple script and the error if someone could tell me or I'm wrong thank you in advance
Working with date/ time is not very intuitive in Lua...
but this script should do what you want.
commandArray = {}
-- os.time() gets the current / date time as a number (seconds since 1970)
-- os.date ('*t', <number> ) returns a date / time table based on <number>
local now = os.date('*t',os.time()) -- get current date / time in table now
for key, value in pairs(now) do
print (key .. ' ==>> ' .. tostring(value)) -- print content of table
end
-- Déclenchement tous les jours à 0:02
if now.wday == 5 and now.hour == 17 and now.min == 55 then
commandArray['SAM']='On'
end
return commandArray
Hydci wrote: ↑Thursday 31 October 2019 18:08
Okay not very intuitive so how would you do actions at certain times with specific days? What do you recommend?
I would use dzVents or if you don't want that something as I posted a couple of minutes ago..