lua-users home
lua-l archive

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


Good day everyone, 

I was trying to write a piece of code that avoids creating lambdas and instead would feature simplified logic like this:

int "a" < int "b"
-- instead of
function(params) return params.a < params.b end

While I can get things like 

print((int "a" * int "b" + int "c") {a = 1; b = 2; c = 3}) -- prints 5

working, the comparison operators are not allowing this since any return value will be turned into "true".

There are other cases where it would be useful to be able to return objects. For instance a vector math library could define that the comparison operator compare each scalar value individually and returns a new vector containing only 0/1 values. 

But currently, this is not possible (it seems?). 
Is there any particular reason why it is important to convert returned values that I don't see?

Cheers,
Eike