![]() |
array.reverse()
or array.flip()
It reverses (or flips) the order of an array. I don't think I need to illustrate this, but I will anyway. a, d, s, h, r array.reverse() r, h, s, d, a It would also be great to have array.reverse(start index, end index) a, d, s, h, r array.reverse(1, 3) a, h, s, d, r |
Could always get Skyld to add something like:
PHP Code:
|
Not trying to be negative, seriously. But can anyone show me a use of this?
|
I'm sure there are a few moments in time someone would like to flip a list of whatever.
|
Well it can be a shortcut for, for each loops.. like:
PHP Code:
|
You should be able to change the "keys" of arrays, just like in PHP.
Now, that would be something... |
Quote:
|
Alright, thanks you guys. I was literally drawing a blank of when I would ever use it, but the pathfinding thing made sense.
|
I see no point for it to be added into the engine ;o
|
Quote:
Agreed. With most languages you would have to do something like what Jer posted, and it's not like it's difficult to reverse arrays anyways. If Stefan is willing to update it to the engine then by all means go ahead, I just don't think it's one of those things that really needs to be there. |
| All times are GMT +2. The time now is 05:12 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.