Thread: sort by date
View Single Post
06-18-20, 09:12 AM   #7
nirran
A Murloc Raider
Join Date: Mar 2005
Posts: 8
awesome,got it working all cept the orderis backwards,this si what i have

Code:
function dateSort(dateTable)

    table.sort(
        dateTable,
        function(k, v)
			local day1, month1, year1 = k:match("(%d%d)(%d%d)(%d%d)")
			local day2, month2, year2 = v:match("(%d%d)(%d%d)(%d%d)")
			if year1 ~= year2 then
				return year1 < year2
			elseif month1 ~= month2 then
				return month1 < month2
			elseif day1 ~= day2 then
				return day1 < day2
			end
        end
    )
end
how do i reversethe order?

edit : swapping logic worked,nother bug but closer,thnx ppl

Last edited by nirran : 06-18-20 at 11:12 AM. Reason: adding info
  Reply With Quote