On Fri, Nov 11, 2016 at 10:20 PM, Chris Osborne <chris.osborne@xxxxxxx> wrote:Brilliant, thanks very much for pointing this out. This makes it easy to either use a `pcall`, or just `ffi.load` at the top level and then encapsulate the rest in a function (even an IIFE), on an error the garbage is collected but the shared library is still loaded and the correct error is reported. Thanks very much!
The segfault itself is due to the nil table reference.No. Prepend two extra events to my sequence:
-1. An error is raised (e.g. by trying to index a nil value).
0. The top-level LuaJIT REPL performs a full garbage collection cycle
(yes, the top-level REPL calls lua_gc after catching an error and
before printing said error).