lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Oh, found a solution, actually ffi.istype can be replacement here for equality test as it accepts 'obj' param to be type too. So following code works printing 'equal!'

local ffi = require 'ffi'
local charp = ffi.typeof('char *')
if ffi.istype(charp, charp) then
 print 'equal!'
end

Sorry to polluting the list.
-- 
Adam Strzelecki

Wiadomość napisana przez Adam Strzelecki w dniu 25 sty 2012, o godz. 12:03:

> Why it is not possible to compare FFI types? I can compare any other objects but not types created via ffi.typeof
> 
> /usr/local/bin/luajit: /private/tmp/test.lua:3: attempt to compare 'enum 21' with 'enum 21'
> 
> local ffi = require 'ffi'
> local charp = ffi.typeof('char *')
> if charp == charp then
>  print 'equal!'
> end
> 
> Cheers,
> -- 
> Adam Strzelecki
>