diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/l-lua.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/l-lua.lua | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua b/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua index b90f37e3db3..88cde6d1ea8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua @@ -188,7 +188,7 @@ if lua then lua.mask = load([[τεχ = 1]]) and "utf" or "ascii" end -local flush = io.flush +local flush = io.flush if flush then @@ -198,3 +198,25 @@ if flush then local popen = io.popen if popen then function io.popen (...) flush() return popen (...) end end end + +-- new + +FFISUPPORTED = type(ffi) == "table" and ffi.os ~= "" and ffi.arch ~= "" and ffi.load + +if not FFISUPPORTED then + + -- Maybe we should check for LUATEXENGINE but that's also a bti tricky as we still + -- can have a weird ffi library laying around. Checking for presence of 'jit' is + -- also not robust. So for now we hope for the best. + + local okay ; okay, ffi = pcall(require,"ffi") + + FFISUPPORTED = type(ffi) == "table" and ffi.os ~= "" and ffi.arch ~= "" and ffi.load + +end + +if not FFISUPPORTED then + ffi = nil +elseif not ffi.number then + ffi.number = tonumber +end |