Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetWeekDayName

From RoR Wiki

UI Lua API · Time functions
Version: WAR 1.4.8

Returns the name of a day of the week in the language of the computer's regional settings.

name = GetWeekDayName(dayIndex, abbreviated)

Arguments

dayIndex
number – Day of the week, 1 to 7: 1 is Monday, 7 is Sunday. Fractions are dropped.
abbreviated
boolean – true for the short form of the name, false for the full name.

Returns

name
wstring – The day name.

Details

  • The name comes from Windows' locale data for the current thread locale, not from the game's string tables. The full names are the locale's day names, the short ones its abbreviated day names.
  • The day numbering matches GetFirstDayOfWeek.
  • If Windows cannot supply the name, an empty string is returned.
  • With a dayIndex outside 1–7 the client logs the Invalid day index error and returns nothing.
  • abbreviated must be a real boolean. Passing nil or a number raises an Invalid Parameters error.
  • The function needs at least two arguments and only reads the last two.

Errors

This is written to the UI log; the call returns normally.

  • Error in function call 'GetWeekDayName': Invalid day index.

Example

Filling the weekday header of the guild calendar with the first letter of each short name, from ea_guildwindow/source/calendar.lua:

local dayIndex = GetFirstDayOfWeek()
for labelIndex = 1, 7
do
    LabelSetText( "GuildWindowCalendarDOTW"..labelIndex, wstring.sub( GetWeekDayName( dayIndex, true ), 0, 1 ) )
    dayIndex = dayIndex + 1
    if ( dayIndex > 7 )
    then
        dayIndex = dayIndex - 7
    end
end

See also