Skip to content

Control/Extend.lua: table.unpack is Lua 5.2+ (undefined on 5.1), and arrayExtend is off-by-one #2

Closed

Description

@Unisay

Surfaced when the dev shell was pinned to Lua 5.1 (the pslua target); the fork previously tested on Lua 5.3, which hid this.

src/Control/Extend.lua arrayExtend used f(table.unpack(xs, i+1)):

  • table.unpack does not exist in Lua 5.1 (it is unpack in 5.1, table.unpack from 5.2) → runtime nil-call on the 5.1 target.
  • It also spread the tail as varargs and was off-by-one, whereas extend :: (Array a -> b) -> Array a -> Array b takes a single Array argument.

Fix: build the suffix sub-array with an explicit loop (no unpack) and pass it as one Array. Also the FFI value needed the paren-wrapped (function ... end) shape the pslua linker accepts.

Fixed together with the Lua-5.1 pin in the tooling-alignment PR #1 (the fix is coupled: CI cannot go green under 5.1 without it).

Activity

  1. Unisay commented on Jun 15, 2026

    @Unisay
    CollaboratorAuthor

    Verified fixed at v6.0.1: Control/Extend.lua is a pure-Lua loop (no table.unpack) with correct suffix indexing. Pinned in the package set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions