diff --git a/wordclock.lua b/wordclock.lua index c58b5a1..1ecbc98 100755 --- a/wordclock.lua +++ b/wordclock.lua @@ -132,3 +132,78 @@ function display_timestat(hours, minutes, longmode) return ret end +-- @fn display_countwords +-- 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 +-- @return the amount of words, used to describe the time or 0 on errors +function display_countwords_de(words) + local amount=0 + if (words.itis == 1) then + amount = amount + 5 + end + if (words.fiveMin == 1) then + amount = amount + 4 + end + if (words.twenty == 1) then + amount = amount + 7 + end + if (words.ten == 1) then + amount = amount + 4 + end + if (words.threequater == 1) then + amount = amount + 11 + end + if (words.quater == 1) then + amount = amount + 7 + end + if (words.before == 1) then + amount = amount + 3 + end + if (words.after == 1) then + amount = amount + 4 + end + if (words.half == 1) then + amount = amount + 4 + end + if (words.twelve == 1) then + amount = amount + 5 + end + if (words.seven == 1) then + amount = amount + 6 + end + if (words.one == 1) then + amount = amount + 4 + end + if (words.two == 1) then + amount = amount + 4 + end + if (words.three == 1) then + amount = amount + 4 + end + if (words.five == 1) then + amount = amount + 4 + end + if (words.four == 1) then + amount = amount + 4 + end + if (words.nine == 1) then + amount = amount + 4 + end + if (words.eleven == 1) then + amount = amount + 3 + end + if (words.eight == 1) then + amount = amount + 4 + end + if (words.ten == 1) then + amount = amount + 4 + end + if (words.clock == 1) then + amount = amount + 3 + end + if (words.six == 1) then + amount = amount + 5 + end + + return amount +end