I need my dictionary to be in a certain order for other parts of my script to work, what I’m making is a table of a folder in replicated storage holding in values, and I’m trying to put them in a dictionary smallest number to biggest number. My technique of looping thru all does the job, as when I print the values, the numbers are perfectly in a slope, however, when I print the dictionary, its all jumbled, mixed up, well not really mixed up, now everything is in alphabetical order. This is what I used to put a value into my dictionary: table[name] = value. I just want to know if there’s something I can do to insert it in order of when I placed it in, not in order of alphabet. so if I placed a dictionary in the table first, that dictionary will be the first in a list when I loop thru it, and so on, is what I mean. I am making dictionaries, not arrays, table.insert will not work, or will it? I don’t know, just looking for suggestions, thanks!
Make a separate table of the original order of the table (Ill call it orderTable) since this is object based and have it iterate thru a table.insert loop to correspond with your dictionary and the orderTable 
I should have done that! thanks!
You can do something like this:
local lastVal = 0
for i, v in pairs(table) do
if v > lastVal then lastVal = v end
end
—Or for the least greatest number
local lastVal = 1000
for i, v in pairs(table) do
if v < lastVal then lastVal = v end
end
I do understand you’re trying to look through the table from least to greatest or vice versa, but what why exactly would you want to loop the table in order that way?
this is actually 999x simpler I can just strip away the sorting part of my script and replace it with this thanks!
If the table is an array then you may as well use table.sort. With no function specified the default sorting operator is ‘<’.
local Table = {5, 1, 4, 2, 6, 8, 9, 7, 3}
table.sort(Table)
print(Table[1]) --1
print(Table[#Table]) --9
As for the original post, the order of items/entries in a dictionary is undefined, it being in an alphabetic order is purely coincidental, if you want a table that preverses order use an array instead.