Yes true, but it's also locale dependant.
In english, it's true/false, spanish, verdadero/falso, etc...
There's little room for locale in numbers (*), but the concept of
true/false is not directly printable. There is no universal symbol
for true or false...
(And that's why booleans are not coercible).
(*) Though the printing of decimals does vary a bit, for example:
English: 14/10 = 1.4
Spanish: 14/10 = 1,4
D Burgess wrote:
Given that we have modifiers for strings and numbers, I would
have thought for completness booleans was appropraite.
On 8/2/06, Torsten Karwoth <agonizer@gmx.de> wrote:
Am Mittwoch, 2. August 2006 03:16 schrieb D Burgess:
> I just noticed that string.format is missing an option (I think),
> namely, a boolean option.
>
> How about -
>
> %b -> "true" or "false"
> %bc -> "True" or "False"
> %bu -> "TRUE" or "FALSE"
> %b0 -> 0 or 1
>
> David B.
I dont think so. Lua is designed to handle such things easy. Your
suggestion would complicate it a little bit,IMHO to much effort
and to little use.
local b = function(Test) return Test and "true" or "false"; end
local bc = function(Test) return Test and "True" or "False"; end
local bu = function(Test) return Test and "TRUE" or "FALSE"; end
...
print(string.format("%s %s %s\n", b(false), bc(false), bu(false)));
print(string.format("%s %s %s\n", b(true), bc(true), bu(true)));
false False FALSE
true True TRUE
> return bu(1 == 2)
FALSE
> return bu(1+1 == 2)
TRUE
>
HTH
Torsten
--
// david morris-oliveros
// camera & lua coder
// david@teambondi.com