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?


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

Try this instead:

local lasers = {

local collectors = {

local neutrals = {}

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

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