# table.sort方法
默认升序排列
local test = { 11, 32, 3 , 4}
--[[table.sort(test,function(a, b)
print(a .. "< " .. b )
local result = (a < b) and "true" or "false"
print(result)
-- 如果返回true,则表示a在b左边
return a < b
end)]]--
table.sort(test)
for i=1, #test do
print(test[i])
end
-- 输出:
-- 3
-- 4
-- 11
-- 32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17