Table dictionary not going in order

I have already set all the indexes, why is it doing this?

This is for a cutscene.

local textThing = {
		["bro you're horrible at your job you're fired noob"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "Boss",
			["index"] = 1
		},
		
		["oh a naww your gonna regert that"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "You",
			["index"] = 2
		},
		
		["regret*"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "Boss",
			["index"] = 3
		},
		["boi if you do that again i swear"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "You",
			["index"] = 4
		},
		["get pooed on"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "Boss",
			["index"] = 5
		},
		
		["bruh thats it"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "You",
			["index"] = 6
		},
		
		["what u gonna do, take revenge?"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "Boss",
			["index"] = 7
		},
		["yes"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "You",
			["index"] = 8
		},
		["wgat"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.1,
			["Name"] = "Boss",
			["index"] = 9
		},
		["nothing!!!!!!"] = {
			["StopForGrammar"] = false,
			["TimePerLetter"] = 0.05,
			["Name"] = "You",
			["index"] = 10
		}
	}

Result:

 bro you're horrible at your job you're fired noob  ▶ {...}  -  Edit
  23:29:49.742  regret*  ▶ {...}  -  Edit
  23:29:49.742  yes  ▶ {...}  -  Edit
  23:29:49.742  nothing!!!!!!  ▶ {...}  -  Edit
  23:29:49.743  boi if you do that again i swear  ▶ {...}  -  Edit
  23:29:49.743  get pooed on  ▶ {...}  -  Edit
  23:29:49.744  bruh thats it  ▶ {...}  -  Edit
  23:29:49.744  oh a naww your gonna regert that  ▶ {...}  -  Edit
  23:29:49.745  what u gonna do, take revenge?  ▶ {...}  -  Edit
  23:29:49.745  wgat  ▶ {...}

How are you getting the index?

for text, properties in pairs(textThing) do
	typewriter.Typewrite(workspace.Info.Subtitle,text,properties.StopForGrammar,properties.TimePerLetter,(properties.Name or nil))
end

Dictionaries have no order only arrays.

How would I make this in order?

local textThing = {
	{
		["Text"] = "bro you're horrible at your job you're fired noob",
		["StopForGrammar"] = false,
		["TimePerLetter"] = 0.05,
		["Name"] = "Boss",
		["index"] = 1
	}
}

Make it into an array into this format, I’ve done the first one for you.

Then you loop through it.

for_, properties in textThing do
	typewriter.Typewrite(workspace.Info.Subtitle,properties.Text,properties.StopForGrammar,properties.TimePerLetter,(properties.Name or nil))
end

It’s not an array, so it will not sort. The text should not be indexed by an index key, nor should you be using the bracket operator instead of the dot operator, which looks like:

local myDictionary = {
	Hello = { --instead of ["Hello"], since this uses up four less characters and improves script editor loading times and improves compiling performance.
		"World"
	}
}
print("Hello ", myDictionary.Hello)

Thank you everyone for contributing, but I have found a solution myself.

I used the index property to sort it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.