I'm not sure if this is related, but the tostring doesn't print the enum value... local ffi = require "ffi" ffi.cdef[[ typedef enum { foo, bar } MyType; ]] print(ffi.new("MyType",ffi.C.bar)) -- cdata<enum 95>: 1 Is there any way it could show "cdata<enum 95>: bar"? (or even "cdata<MyType>: bar")