Modul:Age: Unterschied zwischen den Versionen
K
keine Bearbeitungszusammenfassung
K (clarify) |
KKeine Bearbeitungszusammenfassung |
||
Zeile 16: | Zeile 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 | -- * 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 |