lune/tests/ffi/external_pointer/pointerRead.luau

8 lines
408 B
Text

local callableWrapper = require("../utils/callableWrapper")
local ffi = require("@lune/ffi")
local lib = require("../utils/compile")("./tests/ffi/external_pointer/lib.c")
local c = ffi.c
local pointerRead = callableWrapper(lib:find("pointer_read"), { c.int:ptr() }, c.int)
local result = pointerRead(c.int:box(123):ref():ref())
assert(result == 123, `pointerRead failed. result expected 123, got {result}`)