So would this work? (no underlined errors are popping up)
local ifStatement = os.time() == os.time({year = 2020; month = 5; day = 16})
if ifStatement then
print(ifStatement)
end
No other information included.
So would this work? (no underlined errors are popping up)
local ifStatement = os.time() == os.time({year = 2020; month = 5; day = 16})
if ifStatement then
print(ifStatement)
end
No other information included.
This will definitely not throw any errors, but I assume that you want the ifStatement
to be true for the whole day when 16th May 2020 comes.
This will only work for one second on that day, as os.time
function returns the time in seconds since the UNIX epoch.
If you want the statement to be true for the whole day, you would have to get the year, month and day values for present day
local t = os.date("!*t")
And compare it with the day you are waiting for:
local t1 = os.date("!*t")
local t2 = {year = 2020; month = 5; day = 16}
if t1.year == t2.year and t1.month == t2.month and t1.day == t2.day then
-- something
end