|
On 23/08/14 08:57 AM, Thiago L. wrote:
Eh the mailing list is dead (but I can still see the messages... you can call it hax :P)On 23/08/14 02:27 AM, Coroutines wrote:On Fri, Aug 22, 2014 at 3:59 PM, Thiago L. <fakedme@gmail.com> wrote:Here's an example: Lua: rawequals(a,b) gettable "rawequals" 0 1 <get a> <get b> call 1 2or basically, get "rawequals" from a table, get a, get b, call "rawequals"JS: a === b or basically, get a, get b, compare Can we get a === operator and OP_RAWEQ? (And OP_RAWGET and OP_RAWSET but idk what syntax/operators they would use...)I am super confused by what you're asking. Lua's == is like Javascript's === in that Lua doesn't allow any type inequality between what's on the left and right-hand side. It is already a rawequal().You can override/overload == tho...
Let me explain that a bit better: you can set an __eq metamethod that lets you compare your special object to anything in any way you want (which may be useful for (for example) a big number library), but when you want a raweq, you have to use rawequal() (or is it rawequals? can't remember), which's a C function call, and we all know function calls can be expensive. Instead I want an OP_RAWEQ bytecode, and "a === b" to use it.