lua-users home
lua-l archive

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


I'm using luajit ffi for a month now. I found that it's not just a
library as it extends the language in some key semantics:

(1) values of different types can be compared (Lua can't do that);
this makes things easier most of the time, and a tricky sometimes[1]
(2) type(cdata) == "cdata" -- so now we have the 9th Lua type -- ok
you can overload type(), but maybe ffi.type() similar to io.type()
would have been better, dunno.

I don't think you can make luaffi a drop-in replacement for lj ffi
without patching Lua to address (1) am I right?

[1] for a null pointer a, `a == nil` is true but `not a` is false and
`a = a or default` is not the same for a null pointer a and for a nil
value a.