local ffi = require("cffi")
local S = ffi.metatype("struct { int x; }", {
__new = function(ct, x)
error("__new Called")
return ffi.new(ct, x or 0)
end,
})
local s = S()
Expected is that this test case to raise an error if the library is to operate similar to LuaJIT and as described in semantics.md. However it returns without error.
This is the output on LuaJIT (with require("ffi"))
luajit: test.lua:5: __new called
stack traceback:
[C]: in function 'error'
test.lua:5: in function 'S'
test.lua:10: in main chunk
[C]: at 0x5facfc7a2cd0
Expected is that this test case to raise an error if the library is to operate similar to LuaJIT and as described in semantics.md. However it returns without error.
This is the output on LuaJIT (with
require("ffi")
)