Hi,

Can anyone help?
I'm trying to sort a table of tables, iterating through them in order to send the data to Netremote.

I believe using the pairs funciton should work,
ipairs won't work as the index is not numerical
I can't easily generate the data with an incrementing numerical index as it is generated.
The data shows in the correct order in the variable inspector.

I have a functioning link to a google calendar, and I want to display a 3 month lookahead of calendar events on a netremote page.
Each table name is a date/time string with potentially multiple events if they have the same date and time.

e.g:
Given the following test data:

Code:
test = test or {}
test.Myevents = {

["20160314T000000Z"] = {[1] ="event1 14/03/2016  00:00:00"},
["20160520T000000Z"] = {[1] ="event2 20/05/2016  00:00:00"},
["20160311T000000Z"] = {[1] ="event3 11/03/2016  00:00:00"},
["20160522T000000Z"] = {[1] ="event4 22/05/2016  00:00:00"},
["20160527T000000Z"] = {[1] ="event5 27/05/2016  00:00:00"},
["20160308T000000Z"] = {[1] ="event6 08/03/2016  00:00:00", [2] ="event7 08/03/2016  00:00:00"},
["20160403T230000Z"] = {[1] ="event8 03/04/2016  23:00:00"},
["20160331T073000Z"] = {[1] ="event9 31/03/2016  07:30:00"},
["20160603T000000Z"] = {[1] ="event10 03/06/2016  00:00:00"},
["20160422T000000Z"] = {[1] ="event11 22/04/2016  00:00:00"},
["20160418T000000Z"] = {[1] ="event12 18/04/2016  00:00:00"},
["20160405T230000Z"] = {[1] ="event13 05/04/2016  23:00:00"},
["20160420T000000Z"] = {[1] ="event14 20/04/2016  00:00:00", [2] ="event15 20/04/2016  00:00:00"},
["20160624T000000Z"] = {[1] ="event16 24/06/2016  00:00:00"},
["20160514T000000Z"] = {[1] ="event17 14/05/2016  00:00:00"},
["20160329T000000Z"] = {[1] ="event18 29/03/2016  00:00:00"},
["20160629T230000Z"] = {[1] ="event19 29/06/2016  23:00:00"},
["20160505T230000Z"] = {[1] ="event20 05/05/2016  23:00:00"}
}
I used the following to try to iterate through it and update netremote, note, I try and sort the source table first:

Code:
local i, datetime, Nth, DaysEvents, TheEvent
i = 1
table.sort(test.Myevents)
	for datetime, DaysEvents in pairs (test.Myevents) do
		for Nth, TheEvent in pairs (DaysEvents) do
			print(datetime.." "..Nth.." "..i..": "..TheEvent)
			NetRemote.SetVariable("HOUSE.Calendar."..i..".name",TheEvent)
			i = i + 1
		end
	end
but the sort does not work, the table names do not get sorted in order like they are in the variable inspector.
I've tried dropping out the T and Z letters to just have a number, and removing the " " to make the table name a number, but this does not work.

Is there a way to iterate through a table of sub tables, in alpha numerical order of sub table names?