Looping through a dictionary of animations and returning loaded ones?

I could be overthinking this but I’ve been struggling with this for a while, essentially I’m using metatables to create a combat system, I’m creating an object on Controller.newCombat() which returns an object with quite a few variables as seen here.

function Controller.newCombat(Player)
	local CombatObject = {}
	CombatObject.CharacterObject = Player.Character
	CombatObject.LoadedAnimations = {} -- convert this to a dictionary of loaded animations
	CombatObject.Attacking = false
	CombatObject.Sprinting = false
	CombatObject.Blocking = false
	CombatObject.InCombat = false
	CombatObject.LastAttack = tick()
	CombatObject.LastBlock = tick()
	CombatObject.CurrentCombo = 1
	CombatObject.LastAnim = nil
	
	return setmetatable(CombatObject, Controller)
end

The issue is that I also have this dictionary of animations in the same script:

local Animations = {
	
	Combo1 		= AnimationsFolder.Default.Combos["1"],
	Combo2 		= AnimationsFolder.Default.Combos["2"],
	Combo3 		= AnimationsFolder.Default.Combos["3"],
	Combo4 		= AnimationsFolder.Default.Combos["4"],
	Combo5 		= AnimationsFolder.Default.Combos["5"],
	Stun1 		= AnimationsFolder.Default.Stun["Stun1"],
	Stun2 		= AnimationsFolder.Default.Stun["Stun2"],
	Stun3 		= AnimationsFolder.Default.Stun["Stun3"],
	Idle 		= AnimationsFolder.Default.Idle["Fists"],
	BlockIdle 	= AnimationsFolder.Default.Block["Idle"],
	BlockHit 	= AnimationsFolder.Default.Block["Hit"],
	Grip 		= AnimationsFolder.Default.Grip["AxeKick"],
	
	----General Animations----
	
	Sprint 		= AnimationsFolder.Default.Sprint["Run"],
	
	----Katana Animations Below This Point----
	
	IdleKatana 	= AnimationsFolder.Katana.Idle["Katana"],
	
}

My question is, how can I loop through this dictionary and return the same dictionary except with loaded animations? I’ll need to do this each time the character respawns.

If you’re still confused on what I’m asking for, I want to be able to reference CombatObject.LoadedAnimations.Idle:Play()

Shallow copy the dictionary to copy it then, replace it with loaded animations via a loop, pairs should work better for a dictionary in this scenario.

I forgot you could loop through a dictionary, yikes, thank you.

Here’s the code I ended up using anyways, I just created a new dictionary and set the index to the name of the animation, but changed the value to the loaded one.

function Controller.newCombat(Character)
	local CombatObject = {}
	CombatObject.CharacterObject = Character
	CombatObject.LoadedAnimations = {}
	CombatObject.Attacking = false
	CombatObject.Sprinting = false
	CombatObject.Blocking = false
	CombatObject.InCombat = false
	CombatObject.LastAttack = tick()
	CombatObject.LastBlock = tick()
	CombatObject.CurrentCombo = 1
	CombatObject.LastAnim = nil
	
	return setmetatable(CombatObject, Controller)
end

function Controller:LoadAnimations()
	local Animator = self.CharacterObject:WaitForChild("Humanoid").Animator
	local NewLoadedAnimations = {}
	for animTitle, animObject in pairs (Animations) do
		local newAnim = Animator:LoadAnimation(animObject)
		NewLoadedAnimations[animTitle] = animObject
	end
	self.LoadedAnimations = NewLoadedAnimations
end