lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Alexandre Erwin Ittner a écrit :
May I ask you (and others) why you need boolean operators in Lua? (This
is not a rhetorical question. I really want to know what uses boolean
operators may have in Lua.)

Some time ago, a wrote some bindings to libraries that uses bitwise OR to
combine options. So, people using something like
  xxx_type *hl xxx_open("~/blerg.boo", XXX_CREATE | XXX_SOMETHING_ELSE);

will not be confused when porting code to Lua:
   local hl = xxx.open("~/blerg.boo", xxx.CREATE + xxx.SOMETHING_ELSE)

Which of course is risky if you combine options with same bit set (eg., still with Windows styles, some styles are just aggregates of other styles).

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --