import console;
var t = {
[11]={id=11;classId=3;name="张三"};
[4]={id=4;classId=3;name="张三"};
[1]={id=1;classId=3;name="张三"};
[99999999]={id=99999999;classId=3;name="张三"};
[2]={id=2;classId=3;name="张三"};
strkey9 = "str999999";
strkey1 = "str111111";
}
console.dump("原稀疏数组:",t,"#t获取的成员数:",#t,'\n\n')
var ts = time.tick()
var s,a,b = {},table.range(t);
for(i=a;b;1){
if t[i]!==null {
table.push(s,t[i])
}
}
ts = time.tick()-ts
console.dump("生成一个有序数组(忽略字典成员):",s,"#t获取的成员数:",#s,"耗时:",ts,'\n\n')
var ts = time.tick();
var keys,result={},{};
for(k,v in t){
if type(k)==="number" ..table.push(keys,k);
}
..table.sort(keys);
for(i=1;#keys;1){
..table.push(result,t[keys[i]]);
}
ts = time.tick()-ts
console.dump("生成一个有序数组(忽略字典成员):",result,"#t获取的成员数:",#result,"耗时:",ts,'\n\n')
console.pause();