Hiya everyone, Toothless here!

It's been a super long time since I visited, but I've been working on a new game using xLib, which is amazing, and ran into an awesome shortcut to a big problem I had back in the day. It may have been discovered before a long time ago, but I just wanted to post it up to make sure anyone who needed it could find it. ^.^

It was incredibly hard to find the location of an element in a list or a matrix, and most methods involved long For() loops that checked every value and took absolutely FOREVER.

For this one, I wanted to assign a value to variable F for the key that the user pressed. So if the user presses left, it would equal 1, right = 2, up = 3, and down = 4, for sprite orientation.

`sum((K={24,26,25,34})({1,2,3,4`

And that's it! Breaking it down, the K={24,26,25,34} returns back a list of 0s and 1s, where 0 means the value does not equal K, and 1 where it does. Then, I multiply that answer with a list containing numbers 1 - 4, equal to the dim() or number of elements in the list, thus multiplying the 1 by the slot number. I then use sum() to convert it into a standard number, and boom, you're done. You can also do the same for matrices, by equating it to a number then multiplying the result by a matrix 1 through however many numbers you have.