Weird behavior when creating a 3D array

Hello! I’m trying to create a 3D array that uses strings, then numbers, then numbers again. Problem is when I do so, the final part of the array ends up only showing one of the actual elements present, as shown below:

Code

local saberParts = {
	["Lightsaber"] = {
		[1] = {
			PART_OBJECT.new("Apprentice Emitter","Emitter",SABER_HILTS.Lightsaber["Apprentice Emitter"],true,1),
			PART_OBJECT.new("Initiate Emitter","Emitter",SABER_HILTS.Lightsaber["Initiate Emitter"],true,1),
			PART_OBJECT.new("Fallen Emitter","Emitter",SABER_HILTS.Lightsaber["Fallen Emitter"],true,1),
			PART_OBJECT.new("Kylo Ren Emitter","Emitter",SABER_HILTS.Lightsaber["Kylo Ren Emitter"],true,1),
		},
		[2] = {
			PART_OBJECT.new("Apprentice Switch","Switch",SABER_HILTS.Lightsaber["Apprentice Switch"],true,1)
		},
		[3] = {
			PART_OBJECT.new("Apprentice Sleeve","Sleeve",SABER_HILTS.Lightsaber["Apprentice Sleeve"],true,1)
		},
		[4] = {
			PART_OBJECT.new("Apprentice Pommel","Pommel",SABER_HILTS.Lightsaber["Apprentice Pommel"],true,1)
		},
	},
	["Protosaber"] = {
		[1] = {

		},
		[2] = {

		},
		[3] = {

		},
		[4] = {

		},
		[5] = {
			
		},
	},
}
print(saberParts)

Expected output:

{
 ["Lightsaber"] = {
  [1] = {
   Appentice Emitter,
   Initiate Emitter,
   etc.}
  [2] = {
   Apprentice Switch,
  }
  [3] = {
   Apprentice Sleeve,
  }
  [4] = {
   Apprentice Pommel,
  }
 }
}

Actual output:

{
 ["Lightsaber"] = {
  [1] = {
   Appentice Emitter,
   }
  [2] = {
   Apprentice Switch,
  }
  [3] = {
   Apprentice Sleeve,
  }
  [4] = {
   Apprentice Pommel,
  }
 }
}

This may be because i’m using module scripts to act as objects for OOP, but it doesn’t explain why the rest of the elements aren’t in the array at all, as I know for absolute certain that its because it’s a 3D array. I’ve tested it without the first String element and everything worked as intended.

Any help is appreciated, thanks!

Can you verify your PART_OBJECT constructor returns a value for the additional 3 calls in the first index in Lightsaber?

Just wondering if something is going wrong with the arguments you’re sending through, could I take a peek at that function maybe?

Here’s the class:

local module = {}

module.__index = module

function module.new(partName,partType,reference,unlocked,subSaberType,specialPart,specialPartFunction)
	local newObj = {}
	setmetatable(newObj,module)

	newObj.Name = partName
	newObj.Type = partType
	newObj.Reference = reference
	newObj.Unlocked = specialPart
	newObj.SubSaberType = subSaberType
	newObj.SpecialPart = specialPart
	newObj.SpecialPartFunction = specialPartFunction

	return newObj
end

function module:getName()
	return self.Name
end

function module:getType()
	return self.Type
end

function module:getReference()
	return self.Reference
end

function module:getUnlocked()
	return self.Unlocked
end

function module:getSubSaberType()
	return self.SubSaberType
end

function module:isSpecialPart()
	return self.SpecialPart
end

function module:weldSpecialPart(part,char,miscData)
	self.SpecialPartFunction(part,char,miscData)
end

function module:setUnlocked(v)
	self.Unlocked = v
end


return module

The thing is it doesnt return any errors or anything and it works fine, the only issue is when referenced in the code even if using a different index it returns the first value every time

Say for example I want to get the kylo ren emitter, if I do partsArray[“Lightsaber”][1][4] it returns the top value