nasu
New Member
Posts: 2
|
Post by nasu on Jan 6, 2019 3:40:17 GMT
I was wondering if a action could be made to run from a specific time in the script. So that I could make it do none do all none time sensitive things first then wait till os time is 2pm 3pm 8pm 10pm 11pm.
|
|
|
Post by AnkuLua on Jan 6, 2019 3:49:13 GMT
Use os.date() www.lua.org/pil/22.1.htmlFor example, to get the hour and minute in 24-hour clock os.date("%H%M") Note: the return value is string. You can convert it to number by t = 0 + os.date("%H%M")
|
|
nasu
New Member
Posts: 2
|
Post by nasu on Jan 6, 2019 4:54:07 GMT
Thank you very much for the fast reply. I'm very new to writing code. Would you be able to give me an example of how it should be written for 2pm and 3pm. I should be able to work it full out then. I found that link before asking but couldn't wrap my head around how the code should look. Again thank you very much for the reply.
|
|
|
Post by AnkuLua on Jan 6, 2019 10:20:28 GMT
Thank you very much for the fast reply. I'm very new to writing code. Would you be able to give me an example of how it should be written for 2pm and 3pm. I should be able to work it full out then. I found that link before asking but couldn't wrap my head around how the code should look. Again thank you very much for the reply. Here is the example t = 0 + os.date("%H%M") if (t > 1400 and t < 1500) then -- between 2pm and 3pm print ("between 2pm and 3pm") -- do anything else end
|
|