Fandom

武装突袭 Wiki

Sort

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 分享

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

Introduced with Arma 3 version 1.44
  

点击图片可看到更多讯息

开始使用于

游戏:
Arma 3
版本:
1.44

描述

描述:
Attempts to sort given array either in ascending (true) or descending (false) order. All array elements should be one of the following types:

  • String - array of strings (["a","b","c"...])
  • Number - array of numbers ([1,2,3...])
  • Array - array of subarrays ([["a",1,2],["b",3,4],["c",5,6]...]). Subarrays should be of the same structure. Subarray elements other than String or Number will be ignored during sorting.

Mixed arrays (["a",1,[true]...]) are not supported and results are undefined.

基本句法

句法:
array sort order
参数:
array: Array

order: Boolean - true: ascending, false: descending
返回值:
Nothing

范例

范例1:
_arr = [5.21725,1.30859,4,5.03028,1]; _arr sort true; hint str _arr; //[1,1.30859,4,5.03028,5.21725]

范例2:
_dev = ["ja","pa","pa","tram","tara"]; _dev sort false; hint str _dev; //["tram","tara","pa","pa","ja"]

范例3:
#define ASC true #define DESC false _scores = [[123,"bob",15],[123,"bill",20],[200,"dave",21],[200,"steve",11]]; _scores sort DESC; hint str _scores; //[[200,"steve",11],[200,"dave",21],[123,"bob",15],[123,"bill",20]]

范例4:
Sort buildings by distance and return position of the most distant building:_buildings = player nearObjects ["Land_Cargo_Patrol_V1_F", 500]; { _buildings set [_forEachIndex, [_x distance player, _x]]; } forEach _buildings; _buildings sort false; hint format [ "Most distant building is at %1, distance %2 m", getPos (_buildings select 0 select 1), round (_buildings select 0 select 0) ];

额外资讯

多人游戏:
-
也可以看看:

setpushBackpushBackUniqueapplyselectresizereversecountfindinforEachdeleteAtdeleteRangeappendtoArraytoStringparamparamsarrayIntersectsplitStringjoinStringBIS_fnc_sortAlphabeticallyBIS_fnc_sortByBIS_fnc_sortNum

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

Posted on April 16, 2015 - 18:14 (UTC)
Killzone Kid
The algorithm for sorting subarrays: compare 1st element, if equal compare 2nd, if equal compare 3rd...etc.

更多维基

随机维基