invalid order function for sorting
来源:互联网 发布:shipyard 增加node 编辑:程序博客网 时间:2024/06/05 20:07
t = {
{lv = 1 , score =2,id = 1 },
{lv = 1 , score =2 ,id = 2},
{lv = 1 , score =2 ,id = 3},
{lv = 1 , score =2 ,id = 4}
}
function compFunc(a, b)
if a.score == b.score then
if a.lv == b.lv then
return true -- return true cause "invalid order function for sorting" , must return false here
else
return a.lv > b.lv
end
else
return a.score > b.score
end
end
table.sort(t,compFunc)
{lv = 1 , score =2,id = 1 },
{lv = 1 , score =2 ,id = 2},
{lv = 1 , score =2 ,id = 3},
{lv = 1 , score =2 ,id = 4}
}
function compFunc(a, b)
if a.score == b.score then
if a.lv == b.lv then
return true -- return true cause "invalid order function for sorting" , must return false here
else
return a.lv > b.lv
end
else
return a.score > b.score
end
end
table.sort(t,compFunc)
阅读全文
0 0
- invalid order function for sorting
- lua的table.sort 中出现 invalid order function for sorting
- lua的table.sort 中出现 invalid order function for sorting
- Lua中table.sort() 报错 attempt to compare number with nil和invalid order function for sorting
- invalid storage class for function "***"
- error: invalid storage class for function 'XXXX'
- invalid storage class for function '__inittest' '__exittest'
- error: invalid storage class for function
- error: invalid storage class for function
- Sorting function in Python
- higher-order function first-order function
- 关于Invalid syntax for function signature in TLD异常的处理
- Python学习笔记 --- 'password' is an invalid keyword argument for this function解决办法
- 关于错误: 'encoding' is an invalid keyword argument for this function的错误原因之一
- python 2.7版本解决TypeError: 'encoding' is an invalid keyword argument for this function
- WPF 3D Transparency Depth-Order Sorting
- Element type is invalid: expected a string (for built-in components) or a class/function (for compos
- python higher-order function demo
- 索引
- 使用CORS:跨域两三事
- JavaScript组成
- 数据库——(8)
- JavaScript基础
- invalid order function for sorting
- 【Linux】【Kernel】BUG: scheduling while atomic问题分析
- [TensorFlow 学习笔记-05]批标准化(Bacth Normalization,BN)
- slice和splice的区别
- JSP基本用法实例
- c#面向对象编程
- VS 配置Directx
- TensorFlow学习笔记(三):tf.nn.conv2d是怎样实现卷积的?
- 接口