Hi Luigi,

> H30/12/27 8:15、luigi scarso <luigi.sca...@gmail.com>のメール:
> 
>> On Wed, Dec 26, 2018 at 12:02 PM ARATA Mizuki <minorin...@gmail.com> wrote:
>> Hi,
>> 
>> Even though LuajitTeX has lfs as a built-in library, trying to load it via 
>> `require` doesn't work.
>> (LuaTeX with Lua 5.2/5.3 doesn't have this problem)
>> 
>> This is because the field package.loaded["lfs"] is not set during 
>> initialization.
>> 
>> To fix this, change Luas_open to set the module (returned by the module 
>> loader) to the package.loaded table, which is available as _LOADED on the 
>> registry table.
>> 
>> Also, zlib suffers from a similar problem, both on LuaTeX and LuajitTeX.
>> 
>> Here is a proposed patch to fix these problems:
>> ...
>> 
>> -- 
>> Mizuki
> 
> 
> require here is not strictly needed, given that the code below work.
> We will check the code above, but lfs has some security implications 
> and zlib is a bit weird to load.
> 
> ...
> 
> --
> luigi 
> 

I know it's not needed to do `require "lfs"` on LuaTeX, but people *does* use 
lfs via require, because it's the standard way to load lfs. A couple of example 
that does `require "lfs"`:

luamplib: https://github.com/lualatex/luamplib/search?q=lfs&unscoped_q=lfs

A code snippet on stackexchange: 
https://tex.stackexchange.com/questions/48179/what-is-the-correct-way-to-delineate-directories-in-lua

So `require "lfs"` should be valid on LuajitTeX, too.

-- 
Mizuki

_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to