lua-users home
lua-l archive

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

On Tue, Sep 21, 2021 at 1:48 PM Roberto Ierusalimschy <> wrote:
> does not say anything about ‘require’ which returns two values since 5.4. it’ll be much better to mention that incompatibility there.

Why is that an incompatibility? Is there any real code that stopped
working because of that change?

-- Roberto

I don't know about "real" real code in the wild that broke, but it's easy to imagine something like this toy example breaking:

local t = {require("mymodule"), require("anothermod"), require("lastmod")}
assert(#t == 3) -- or code that implicitly assumes #t to be equal to 3

Or this toy example:

function modifymodule(mod, flags)
    -- modify module, expecting flags to be a pseudo-enum or nil
    return mod

local mod = modifymodule(require("mod")) -- expecting implicit nil for flags