Trying to save player data to table on move

Hi,

I have five players on screen, and when the user drags a player, I am trying to save the position data for all players so that I can rewind.

My problem is coming up with a data structure that I can use to save this data at runtime and then save/load it.

local players= { tick,

        { pid=1, x =32, y=32, hasball= false },
        { pid=2, x =64, y=32, hasball= false },
        { pid=3, x =164, y=132, hasball= false },
        { pid=4, x =124, y=112, hasball= false },
        { pid=5, x =78, y=78, hasball= true }
    }

Say I moved player 2 and wanted to just insert player 2 data and leave the other players alone because they didnt move, how could I just add Player 2 data?

Is there a better way to represent the data structure?

Thanks, Greg

any help greatly appreciated

I have part of it,

Since I spawned an object within a table, I can use the associated fields right?

print( "object touched = "…tostring(event.target.index))  returns my object.index

so I can know which object to save I think!

I have part of it,

Since I spawned an object within a table, I can use the associated fields right?

print( "object touched = "…tostring(event.target.index))  returns my object.index

so I can know which object to save I think!