Sort order of a list of things?

This is purely a question for curiosity’s sake: if you sort a list of things, what’s the defined sort order? Is it the order in which the things were created by Inform? I’m assuming that’s the case.

I’m guessing there’s no simple way to sort by a property of a thing. Again, not a huge deal, just wondering if anybody knows of one.

You can in fact sort a list by property - see the documentation here!

3 Likes

I’m a little surprised that the compiler allows “sort L;” when L is a list of things. But it does, and yes, it’s object creation order.

Object creation order can be unintuitive in I7. It tends to be the first time the object is mentioned, even if it’s not a “Foo is a thing” sentence. So it’s best not to rely on this, except to say that it’s always consistent within a particular build of the game.

2 Likes

Argh, how did I miss that? Thanks!