From: daurnimator Date: Tue, 23 Jul 2013 22:43:20 +0000 (-0400) Subject: src/timetable: Invent timetable object X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/cf0cc951c06f50ff9390eca662f13d4887c83114 src/timetable: Invent timetable object --- diff --git a/src/timetable.lua b/src/timetable.lua index 81fcbf8..df78b15 100644 --- a/src/timetable.lua +++ b/src/timetable.lua @@ -111,8 +111,29 @@ local function normalise ( tm ) return tm end +local timetable_mt = { +} + +local function cast_timetable ( tm ) + return setmetatable ( tm , timetable_mt ) +end + +local function new_timetable ( year , month , day , hour , min , sec ) + return cast_timetable { + year = year ; + month = month ; + day = day ; + hour = hour ; + min = min ; + sec = sec ; + } +end return { doomsday = doomsday ; normalise = normalise ; + + new = new_timetable ; + cast = cast_timetable ; + timetable_mt = timetable_mt ; }