Losing over half of my data when combining two arrays

Take this line of code

local neutrals = {unpack(lasers), unpack(collectors)}

lasers and collectors are both arrays of size 3 storing the same data, that being a “Laser” metatable.

I have verified with watches and breakpoints that neutrals become a table that only stores the first element of lasers and stores all elements of collectors. Lasers is a frozen table. Why is this happening?

Capture

I don’t think unpack is consistent, there has been plenty of posts about it.

Try this instead:

local lasers = {
	"value1",
	"value2"
}

local collectors = {
	"value3",
	"value4"
}

local neutrals = {}

for i, value in ipairs(lasers) do
	table.insert(neutrals, value)
end

for i, value in ipairs(collectors) do
	table.insert(neutrals, value)
end

print(neutrals)