Table sorting issue

Hello. I want to print out a table in the order that I write it in, but the table keeps automatically sorting. For instance:

local table = {["a"] = 1; ["c"] = 2; ["b"] = 3;}
print(table)

--//Prints: 
--{["a"] = 1, ["b"] = 3, ["c"] = 2}

How do i make it print:

--{["a"] = 1, ["c"] = 2, ["b"] = 3;}

in other words: the table automatically sorts the items, and i dont want it to.

Correct me if I’m wrong, (and I might be, been awhile with this kind of stuff lol), I think you would have to print it via a loop instead.

local table = {["a"] = 1, ["c"] = 2, ["b"] = 3}
for i,v in pairs(table) do
    print(i,v)
end

This should print it as:
[“a”] = 1
[“c”] = 2
[“b”] = 3

change Pairs to ipairs., It’s faster and sorts it

cc. @NoParameters
The order of the indices inside the table is undefined.
In what order do you expect the indices of the table to be printed?

It doesn’t work because the indices aren’t integers.

Oops, I forgot ipairs does that

You can’t use table.sort on tables which are dictionaries, you can only use it to sort elements within tables which are arrays.

That’s the thing, I’m trying not to get it sorted, but the table sorts the items regardless of me not using table.sort

local table = {["a"] = 1, ["c"] = 2, ["b"] = 3}
print(table)

Use commas to separate items instead of semi colons.

right, gosh im an idiot… commas mean read in order. alright, thanks m8.

How would this even remotely help?
This is just a personal preference and there’s no difference to using ; or , in tables except for the syntax.

What? Commas instead of semicolons doesn’t change anything.