maybe run with cffi on PUC Lua? Untested

This commit is contained in:
Jeremy Penner 2022-04-18 22:44:11 -04:00
parent 9f2da61b88
commit 64312e57fa
4 changed files with 9 additions and 8 deletions

View file

@ -1,8 +1,5 @@
--This file is generated by running the -- works with luajit ffi or https://github.com/q66/cffi-lua
--gencodes.lua local ffi = require "diet-sqlite.ffi"
--script. If you want to alter this file, it is best
--to make the changes in that script and run it again.
local ffi = require "ffi"
return { return {
SQLITE_TRANSIENT = ffi.cast('void(*)(void*)', -1); SQLITE_TRANSIENT = ffi.cast('void(*)(void*)', -1);

5
diet-sqlite/ffi.lua Normal file
View file

@ -0,0 +1,5 @@
-- works with luajit ffi or https://github.com/q66/cffi-lua
local ok, ffi = pcall(require, "ffi")
if not ok then ffi = require "cffi" end
return ffi

View file

@ -2,7 +2,7 @@
; It is meant to be an _extremely_ thin wrapper around the SQLite API. ; It is meant to be an _extremely_ thin wrapper around the SQLite API.
(local sqlffi (require :diet-sqlite.sqlite3_ffi)) (local sqlffi (require :diet-sqlite.sqlite3_ffi))
(local ffi (require :ffi)) (local ffi (require :diet-sqlite.ffi))
(local util (require :lib.util)) (local util (require :lib.util))
(local {: SQLITE_OK : SQLITE_INTEGER : SQLITE_FLOAT : SQLITE_NULL : SQLITE_BLOB : SQLITE_TEXT : SQLITE_TRANSIENT} (require :diet-sqlite.codes)) (local {: SQLITE_OK : SQLITE_INTEGER : SQLITE_FLOAT : SQLITE_NULL : SQLITE_BLOB : SQLITE_TEXT : SQLITE_TRANSIENT} (require :diet-sqlite.codes))

View file

@ -10,8 +10,7 @@
** **
--]] --]]
local ffi = require "diet-sqlite.ffi"
local ffi = require "ffi"
--[[ --[[
Created from this version: Created from this version: