Jump to content

Sort table


xyzii

Recommended Posts

So I'm making an updates script with a database. It's finished but there's a flaw. The oldest updates come on top. I know I have to use table.sort

(The meaning is not to sort the rows coming from the database but the table that is in the database row.)

Link to comment
  • Moderators
On 05/03/2017 at 06:08, xyzii said:

The meaning is not to sort the rows coming from the database but the table that is in the database row.

What do you mean by that ? Can you give us a sample of what you get and an example of what you want to get ?

Link to comment

There is a column in the updates database, the column has a day, month, year number. Second column has a table of the updates. I want to sort the table of the updates, not how the database is sorted.

f9f58f9021.jpg

I want that '- Added /updates' to be on the bottom when '- Added locking' should be on the top since that was newly added. 

Link to comment

Because it only sorts the dates in the right order, not the table that is inside a different column, I NEED TO SORT THE TABLE IN THAT COLUMN

or am I understanding something wrong about ORDER BY ASC/DESC?

Edited by xyzii
  • Like 1
Link to comment

Use a local lua table first. Gather the data and store it in the table.

data = {}

for i,v in pairs(data) do
	i = i*-1
    -- then send the data linked to the index from the table to the database.
    -- this will comepletely reverse your table, maybe what you are looking for.
end

This should reverse the tables index.

Edited by shay103
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...