Module:TimeGreeting: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-- Module:TimeGreeting local p = {} function p.getGreeting() local now = mw.getCurrentFrame():callParserFunction("#time", "U") local hours = tonumber(now:match("(%d%d)")) if hours >= 6 and hours < 12 then return "Good morning" elseif hours >= 12 and hours < 18 then return "Good afternoon" else return "Good evening" end end function p.displayGreeting(frame) return p.getGreeting() end return p") |
No edit summary |
||
Line 4: | Line 4: | ||
function p.getGreeting() | function p.getGreeting() | ||
local now = mw.getCurrentFrame():callParserFunction("#time", "U") | local now = mw.getCurrentFrame():callParserFunction("#time", "U", "1") | ||
local hours = tonumber(now:match("(%d%d)")) | local hours = tonumber(now:match("(%d%d)")) | ||
Revision as of 08:58, 19 January 2024
Lua error at line 9: attempt to compare number with nil.
-- Module:TimeGreeting local p = {} function p.getGreeting() local now = mw.getCurrentFrame():callParserFunction("#time", "U", "1") local hours = tonumber(now:match("(%d%d)")) if hours >= 6 and hours < 12 then return "Good morning" elseif hours >= 12 and hours < 18 then return "Good afternoon" else return "Good evening" end end function p.displayGreeting(frame) return p.getGreeting() end return p