lua-users home
lua-l archive

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


On Fri, Mar 3, 2017 at 9:01 PM, Peter Aronoff <telemachus@arpinum.org> wrote:
> Peter Melnichenko <mpeterval@gmail.com> wrote:
>> I've released Luacheck 0.19.0.
>
> Thanks!
>
> A quick question, and I apologize because I don’t recall if this was an
> issue before or it’s new. Like a lot of people, I now use this in modules
> that require unpack:
>
>         local unpack = unpack or table.unpack
>
> That, however, yields this warning from luacheck:
>
>         src/tapered.lua:9:16: accessing undefined variable unpack
>
> I get what’s happening here, and I can simply choose to ignore this
> warning, but I wonder if people have any thoughts about how else to handle
> a cross-lua module that uses unpack.
>
> Thanks, Peter
> --
> We have not been faced with the need to satisfy someone else's
> requirements, and for this freedom we are grateful.
>     Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
>

The best solution is to allow non-portable globals for that line only:

    local unpack = unpack or table.unpack -- luacheck: compat

-- Peter