Editing Module:Sandbox/Valwren
From Fallen London Wiki
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 6: | Line 6: | ||
local function event_start_for_time(time) | local function event_start_for_time(time) | ||
local weekday = os.date("%w", time) | local weekday = os.date("%w", time) | ||
+ | local monday = (4 - weekday) * 86400 + time | ||
-- the below does NOT work | -- the below does NOT work | ||
Line 13: | Line 14: | ||
--return thursday | --return thursday | ||
− | -- | + | -- this one is threw a lua error |
− | + | if weekday == '1' or weekday == '2' or weekday == '3' or (weekday == '4' and os.date("%H%M", time) < '1200') then | |
− | + | monday = monday - (7 * 86400) | |
− | + | end | |
− | + | return monday | |
-- the below works correctly | -- the below works correctly | ||
− | local thursday = (4 - weekday) * 86400 + time | + | --local thursday = (4 - weekday) * 86400 + time |
− | + | --thursday = thursday - (7 * 86400) | |
− | return thursday | + | --return thursday |
end | end |