lua-users home
lua-l archive

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


On Nov 16, 2010, at 11:51 PM, Alexander Gladysh wrote:

> I'm looking for the Lua equivalent for this:
> 
> http://www.boost.org/doc/libs/1_44_0/doc/html/tribool.html

You can get a long way with using

true := 1.0
false := 0.0
indeterminate := NaN

with these functions:

function tri_and (x,y) return x * y end
function tri_or (x,y) return math.min(x + y, 1) end
function tri_not (x) return 1 - x end

> tri_unk = 0/0
> return tri_unk
nan
> =tri_or(0,tri_unk)
nan
> 

e