Skip to content

Instantly share code, notes, and snippets.

@DimitarBogdanov
Created September 24, 2023 18:56
Show Gist options
  • Save DimitarBogdanov/2c72dd31ef5ea465a50e8aca3ee15715 to your computer and use it in GitHub Desktop.
Save DimitarBogdanov/2c72dd31ef5ea465a50e8aca3ee15715 to your computer and use it in GitHub Desktop.
Luau __eq not working compile
Function 0 (__eq):
3: return true
LOADB R0 1
RETURN R0 1
Function 1 (??):
REMARK builtin setmetatable/2
REMARK allocation: table hash 0
1: local t = setmetatable({}, {
NEWTABLE R1 0 0
REMARK allocation: table template 1
DUPTABLE R2 1
2: __eq = function()
DUPCLOSURE R3 K2 ['__eq']
SETTABLEKS R3 R2 K0 ['__eq']
FASTCALL2 61 R1 R2 L0
1: local t = setmetatable({}, {
GETIMPORT R0 4 [setmetatable]
CALL R0 2 1
7: print(t == {}) -- should print true, but prints false
L0: GETIMPORT R1 6 [print]
REMARK allocation: table hash 0
NEWTABLE R3 0 0
JUMPIFEQ R0 R3 L1
LOADB R2 0 +1
L1: LOADB R2 1
L2: CALL R1 1 0
RETURN R0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment