Lostgallifreyan <z.c...@btinternet.com> wrote: (10/08/2010 21:38) >John Labenski <jlaben...@gmail.com> wrote: >(10/08/2010 19:28) > >>function iff(a, b, c) if a then return b else return c end end >> >. >. >. >> print(string.format("%d: %d : %d : Err %d : '%s'\n", i, S:LastRead(), >> iff(S:Eof(), 1, 0), U:GetError(), a)) > >My turn for a small neat idea. :) >Instead of writing a function to test the boolean and return a choice from two >numbers, you can replace the call iff(S:Eof(), 1, 0) by ((S:Eof() and 1) or 0) >and omit the function.
And omit a heap of brackets, apparently...Ò^O Boolean and 1 or 0 Also works with strings of course.. Boolean and "True" or "False" Got to love Lua. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users