Our World of Text:Sandbox: Difference between revisions

From Our World of Text Wiki
Jump to navigation Jump to search
(:P)
(b)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
{{Infobox character
 
| image = File:Placeholder.png
-- Function to calculate the week number based on a given date
| backgroundColor = lightgreen
function p.getPreviousWeekNumber(frame)
| color = green
    -- Define the start date of Week 1
| textColor = lightgreen
    local week1Start = os.time{year=2024, month=9, day=8}
| realName = Glizzy Gobbler
   
| affiliations = Retard Collective
    -- Convert the current date to time format
| sex = Three times a day
    local currentDateTime = os.time{year=currentDate.year, month=currentDate.month, day=currentDate.day}
| marital = Polygamous
   
}}
    -- Calculate the difference in days from the start of Week 1
    local daysDifference = os.difftime(currentDateTime, week1Start) / (24 * 60 * 60)
   
    -- Calculate the week number (rounding down to get integer weeks)
    local currentWeek = math.floor(daysDifference / 7) + 1
   
    -- Calculate the previous week number
    local previousWeek = math.max(currentWeek - 1, 1)  -- Ensure it doesn't go below 1
   
    return 'Weekly Briefing Release'..previousWeek
end
 
return p

Latest revision as of 11:11, 22 November 2024

Sandbox
Placeholder.png
Real nameGlizzy Gobbler
AffiliationsRetard Collective
General information
SexThree times a day
Marital statusPolygamous