| ▲ | shakna 2 hours ago | |
> Sadly comparisons like < and == cannot be overloaded in Lua :( You can overload == in 5.3. Before that, there was a slightly-less-overloadable __eq method. But as of 5.3, as long as the bound __eq method is the same underlying function, it will be called. I assume you meant instead, that the return value of the comparison is always coerced to a boolean, so you can't re-use it to get arbitrary infix operators? For that sort of thing, I've used Mike Pall's hack in the past: | ||
| ▲ | remywang 2 hours ago | parent [-] | |
Nice! Yes I meant the type is coerced to bool. For me the a:eq(b) syntax is already good enough and less hacky | ||