LJIT2SQLite icon indicating copy to clipboard operation
LJIT2SQLite copied to clipboard

Whats line 19 in `sqlite3_ffi.lua` for?

Open o-jasper opened this issue 9 years ago • 2 comments

local codes = require("sqlite-ffi.codes");

I noticed it because it couldnt find the file. However, noticed the variable isnt actually used, and it loads, at least if i remove it.

o-jasper avatar Sep 30 '15 19:09 o-jasper

it refers to codes.lua, the require path is just wrong (did I do that? I don't remember)

it'd be able to find it if you had named the module sqlite-ffi, otherwise you need to add a little magic for require paths within the module to work right:

-- if it's init.lua use this
local current_folder = (...):gsub('%.init$', '') .. "."
-- if it's anything else use this
local current_folder = (...):gsub('%.[^%.]+$', '') .. "."
local codes = require(current_folder .. "codes")

shakesoda avatar Oct 01 '15 03:10 shakesoda

Took the (just the)ffi here, but it is not entirely recognizable anymore.. Obeys "my rules" regarding classes now. (one class per file, just set Class.__index =Class, have a Class:new()instance and instance:init().. i may make it more specific yet..) It also has two options, one that works with lua5.3 too.

o-jasper avatar Oct 06 '15 16:10 o-jasper