Aggregating results of many messages

Hi,
I have a bunch of game objects and want to aggregate their states.
For example “ground” segments a, b, c – each with a list of “occupied_spaces” that can have building objects in them.

What I am doing now is iterating through the list of ground objects and posting a message to “report_free_spaces”, then aggregating the results when they return.

I realize I could use go.get if "occupied_spaces " was a property, but if I want to calculate the value dynamically or return something that isn’t a primitive (i.e. a list or a table), I would need to use message passing.

The problem I have is I don’t know when the results will come back, and I want to update a GUI when I do know. I am thinking to track each object’s message state and then post a message to the GUI when all of the objects have returned.

Do you guys have any advice on the best way to do this? Or should I just store and return hashed ids and not try to do this?

Thanks,
Alex

I’m going to use the go.get approach – it’s working great as long as I make sure to keep the data on a shared object that the gui can reference.