Just thought some noobs might find this code useful. It finds the penultimate item in a list and typecasts it back the the correct type.
For example, if I had a TCard Type and I store them in an ordinary TList called CardList, and then I want to retrieve the penultimate (second from last) card, I can do it like this:
Value() only returns an Object that is not of the correct type so that's why the whole statement has TCard() around it. The "typecasts" the object into a TCard so we can used it.
Hope you find it useful.
For example, if I had a TCard Type and I store them in an ordinary TList called CardList, and then I want to retrieve the penultimate (second from last) card, I can do it like this:
Local c:TCard = TCard(CardList.LastLink().PrevLink().Value())
Value() only returns an Object that is not of the correct type so that's why the whole statement has TCard() around it. The "typecasts" the object into a TCard so we can used it.
Hope you find it useful.