From cf0cc951c06f50ff9390eca662f13d4887c83114 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 23 Jul 2013 18:43:20 -0400 Subject: [PATCH] src/timetable: Invent timetable object --- src/timetable.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 ; } -- 2.39.5