0

I am trying to write a LuaJIT FFI module for sqlite3. The exec function takes a callback for each row returned. https://www.sqlite.org/c3ref/exec.html

in LuaJIT I simply enter

ffi = require 'ffi'
ffi.cast("int (callback*)(void*,int,char**,char**)")

which I think should be the correct cast for a function pointer as per the SQLite docs, but I get:

stdin:1: '<eof>' expected near 'callback'

I am sure I have something wrong in the syntax here, but I can't find any documentation/examples for FFI.cast() used for a function pointer with args.

user2240431
  • 338
  • 2
  • 12

0 Answers0