lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sat, 24 Sept 2022 at 08:35, Viacheslav Usov <> wrote:
> is equivalent to this code:
> local old_require = require
> function my_require(lib)
>     if allow_list(lib) then
>         local stateOpen = true
>         return old_require(lib)
>     end
> end

not it's not.

`stateOpen` is a global (or rather module-level local) variable.  when
a library is approved, it's set to true, thus any further ("inner")
require is approved too until the first one completes.

as said, that's just my first thought.  haven't really checked any corner cases