Module:ErraCalendar: Difference between revisions

From Errapedia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
-- Date table structure
-- "year" = int
-- "month" = int
-- "date" = int
-- "hour" = int
-- "minute" = int
-- "second" = int
local p = {}
local p = {}
local h = {}
local h = {}
Line 18: Line 26:
       end
       end
   end
   end
  return nil
end
end

Revision as of 20:00, 9 February 2023

Documentation for this module may be created at Module:ErraCalendar/doc

-- Date table structure
-- "year" = int
-- "month" = int
-- "date" = int
-- "hour" = int
-- "minute" = int
-- "second" = int

local p = {}
local h = {}

MonthTable = {{name="Een", season="Rise"}, {name="Kar", season="Rise"}, {name="Mir", season="Rise"}, {name="Rort", season="Life"}, {name="Kir", season="Life"}, {name="Sur", season="Life"}, {name="Ith", season="Low"}, {name="Trint", season="Low"}, {name="Sorth", season="Low"}}

function h.GetMonthFromInt( inInt )
   if MonthTable[inInt] == nil then
      return nil
   end
   return MonthTable[inInt]["name"]
end

function h.GetSeasonFromMonthStr( inStr )
   inStr = inStr:lower()
   for _, v in pairs(MonthTable) do
      if v["name"]:lower() == inStr then
         return v["season"]
      end
   end
   return nil
end