Module:Age: Difference between revisions

1 byte added ,  8 years ago
m
no edit summary
m (clarify)
mNo edit summary
Line 16: Line 16:
     return tostring(number) .. sep .. ((number == 1) and singular or plural)
     return tostring(number) .. sep .. ((number == 1) and singular or plural)
     -- this uses an interesting trick of Lua:
     -- this uses an interesting trick of Lua:
     --  * and reurns false if the first argument is false, and the second otherwise, so (number==1) and singular returns singular if its 1, returns false if it is only 1
     --  * and returns false if the first argument is false, and the second otherwise, so (number==1) and singular returns singular if its 1, returns false if it is only 1
     --  * or returns the first argument if it is not false, and the second argument if the first is false
     --  * or returns the first argument if it is not false, and the second argument if the first is false
     --  * so, if number is 1, and evaluates (true and singular) returning (singular); or evaluates (singular or plural), finds singular non-false, and returns singular
     --  * so, if number is 1, and evaluates (true and singular) returning (singular); or evaluates (singular or plural), finds singular non-false, and returns singular
Anonymous user