How to arrange a table in ascending order

local group={5, 6,9,1}
local arranged={}
for i, v in pairs(group) do
----how to do this
end

local group = {5, 6, 9, 1}
table.sort(group)

for _, v in ipairs(group) do
	print(v)
end

What exactly are you trying to do? Are you trying to sort the group based on their value? Example:

local arranged = {1, 5, 6, 9}

or are you trying to do something else?

1 Like

I was trying to arrange them in ascending order

This might help you: