Skip to content

Dash.join/Dash.assign fails to update mixed arrays appropriately because array detection logic is flawed #3

@Quenty

Description

@Quenty

Dash.join fails to update mixed arrays properly, leading to unexpected behavior when using join to assign values.

Reproduction

local array = { 0, 0, 0 }
local changed = {} -- Must construct like this for it to fail
changed[1] = 1
changed[3] = 1

-- Expected: { 1, 0, 1 }
-- Actual:   { 1, 0, 0 }
print(Dash.join(array, changed))

-- Root cause: iterator() implementation checks `#changed > 0` to see if it is an array, and
-- if it does, uses ipairs
print("#changed", #changed)
for key, value in ipairs(changed) do
	print("this will only print once, not twice")
end

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