lua table 重要函数
来源:互联网 发布:淘宝直播刷人气 编辑:程序博客网 时间:2024/04/30 10:51
1 求长度操作# a = {“c”,”b”,”a”}
#a=3
给table添加元素a[#a + 1] = “d”
2 table.concat(table, sep, start, end)
讲从start开始到end的元素以sep作为分隔符链接成一个整体
例:
tbl = {“alpha”, “beta”, “gamma”}
print(table.concat(tbl, “:”))
alpha:beta:gamma
3 table.sort(table,comp)
对table中的元素进行排序默认升序
comp自定义排序方式
此函数应满足以下条件: 接受两个参数(依次为a, b), 并返回一个布尔型的值, 当a应该排在b前面时, 返回true, 反之返回false.
sortFunc = function(a, b)
return b < a
end
table.sort(tbl, sortFunc)
print(table.concat(tbl, “, “))
gamma, delta, beta, alpha
function sortLevelNameAsc(a, b) if a.level == b.level then return a.name < b.name else return a.level < b.level endend
0 0
- lua table 重要函数
- lua重要函数
- lua table常用函数
- lua table函数
- lua的table相关函数
- Lua封装打印Table函数
- Lua 自定义打印table函数
- Lua table转string函数
- Lua标准库中部分重要函数
- Lua 中 table.sort 的比较函数
- lua函数table.remove的使用
- LUA中的Table.getn()函数的用法
- lua table中可以有函数
- Lua中table函数的总结
- LUA中常用的table函数
- Lua 笔记14 table库常用函数
- lua中table操作的相关函数
- C加载lua配置,table交互, 调用lua函数
- 使用FileSystemWatcher监控文件变化
- Quick-Cocos2d-x v3.3文件结构分析
- Broadcom收购Teknovus公司,获得EPON技术
- 在Unity3D的Legacy动画系统中应用Root Motion
- MYSQL分区表测试
- lua table 重要函数
- CentOS6常用命令
- AFNetworking断点续传、下载图片
- 使用 jQuery Mobile 与 HTML5 开发 Web App(十五) —— jQuery Mobile 与响应式
- iOS:日期 时间类操作 NSDate、calendar、formatter、components、locale、timeZone - houseq 的专栏 - 博客频道 - CSDN.NET
- C#泛型方法 返回泛型参数默认值
- 新年吐个槽~哈哈
- Paint方法setXfermode
- 放大发生的