C Pointer comparison

Pointer objects support comparison operators, comparing C pointers by the memory address they point to.

Notes

  • You can only compare between Pointer objects, not with Lua values.

Example

local c = require "c" -- Creates a Pointer to a C string local str = c.string("C FFI Moddule") local c_ptr = c.Pointer(str) -- Prints "true" : both Pointers point to the same C string print(c_ptr == c.Pointer(str))