lua-users home
lua-l archive

Re: [Proposal] Overload | for booleans

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


On 29/07/15 11:18 AM, Dirk Laurie wrote:
2015年07月29日 15:56 GMT+02:00 Soni L. <fakedme@gmail.com>:
Can we get true | false to be a thing?
debug.setmetatable(true,{
 __bor = function(x,y)
 assert (type(x)=='boolean' and type(y)=='boolean')
 return x or y
 end;
 __band = function(x,y)
 assert (type(x)=='boolean' and type(y)=='boolean')
 return x and y
 end;
})
I like that! But why do you call it a proposal?
It would be non-short-circuiting and/or.
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.

AltStyle によって変換されたページ (->オリジナル) /