I have a question about working around the behavior of metatables when it comes to invoking the "__eq" or "==" abstraction for a userdata and `nil`.
From the docs (emphasis mine):
Lua will try a metamethod only when the values being compared are either
both tables or both full userdata and they are not primitively equal.
The result of the call is always converted to a boolean.
This prevents me from doing "some_userdata == nil" and having it return true in the case of working with something like a nullptr. I want to keep the ease-of-use/"C-like" style of comparing against Nil, but I cannot invoke a metamethod to check. Does anyone have any suggestions? I'm open to just about anything, and obviously the more elegant/syntax-clean suggestion the better.
Previously, I used to return an actual "nil" when I detected "nullptr"
in the connected C code, but I can't do that anymore due to complicated typing issues that can be somewhat explained in these github issues: