Skip to content

Commit

Permalink
Fix bug with __eq meta-method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium committed May 19, 2013
1 parent 57300a8 commit f96bfb5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions native_objects/gen_lua_ffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,14 @@ do
end
function obj_mt.__eq(val1, val2)
if not ffi.istype(obj_type, val2) then return false end
assert(ffi.istype(obj_type, val1), "expected ${object_name}")
if not ffi.istype(obj_ctype, val2) then return false end
assert(ffi.istype(obj_ctype, val1), "expected ${object_name}")
return (C.memcmp(val1, val2, ${object_name}_sizeof) == 0)
end
-- type checking function for C API.
local function c_check(obj)
if ffi.istype(obj_type, obj) then return obj end
if ffi.istype(obj_ctype, obj) then return obj end
return nil
end
_priv[obj_type] = c_check
Expand Down

0 comments on commit f96bfb5

Please sign in to comment.