我一直在寻找高低,并试图在不同的阶段实现这一目标。我正在尝试对基于另一个表值的几个表进行排序。我试图通过播种 ak, v 对这些表进行排序,其中 v 是布尔值。
这是我到目前为止所得到的......并提前感谢您的帮助。
function byInstallsField(x,y)
-- cant seem to make sens out of the sorting
if x.installed then return true
elseif y.installed == false then return false
end
end
-- var is the index passed into the function
-- pRect:new is a custom lib for rect' drawing
playerRect[ var ] = pRect:new(_W + dimesion_for_rect * var, 0,
dimesion_for_rect,
dimesion_for_rect,
3 ) -- _x, _y , _hieght, _width, round
playerRect.installed = inst;
table.sort( playerRect, byInstallsField )
downloadedImage[ var ] = fb_friends:new(var, imageOnFile,
playerRect[ var ].x,
playerRect[ var ].y,
0.25, 0.25, 0, dimesion_for_rect - 5)
downloadedImage[ var ].id = var
downloadedImage.installed = inst
table.sort( downloadedImage, byInstallsField )
我希望对 playerRect 和下载的图像表进行排序的结果,以便安装的 that = true 将引导数组..
播放器 1.installed = true ,播放器 2.installed = true ,播放器 3.installed = false