Refactored character counting function
This commit is contained in:
parent
be8b8a99ca
commit
cb5205d4af
2
main.lua
2
main.lua
@ -50,7 +50,7 @@ function displayTime()
|
|||||||
time = getTime(sec, timezoneoffset)
|
time = getTime(sec, timezoneoffset)
|
||||||
words = display_timestat(time.hour, time.minute)
|
words = display_timestat(time.hour, time.minute)
|
||||||
|
|
||||||
local charactersOfTime = display_countwords_de(words)
|
local charactersOfTime = display_countcharacters_de(words)
|
||||||
ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
|
ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
|
||||||
charactersOfTime)
|
charactersOfTime)
|
||||||
|
|
||||||
|
@ -136,11 +136,11 @@ function display_timestat(hours, minutes, longmode)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @fn display_countwords
|
-- @fn display_countcharacters_de
|
||||||
-- Count the amount of characters, used to describe the current time in words
|
-- Count the amount of characters, used to describe the current time in words
|
||||||
-- @param words the same structure, as generated with the function @see display_timestat
|
-- @param words the same structure, as generated with the function @see display_timestat
|
||||||
-- @return the amount of words, used to describe the time or <code>0</code> on errors
|
-- @return the amount of words, used to describe the time or <code>0</code> on errors
|
||||||
function display_countwords_de(words)
|
function display_countcharacters_de(words)
|
||||||
local amount=0
|
local amount=0
|
||||||
if (words.itis == 1) then
|
if (words.itis == 1) then
|
||||||
amount = amount + 5
|
amount = amount + 5
|
||||||
|
Loading…
Reference in New Issue
Block a user