Lua之Next用法
来源:互联网 发布:淘宝女单图片 编辑:程序博客网 时间:2024/05/16 05:52
想输出 “1,2,3"的时候 以前的写法都是
local testTable ={"1","2","3"}
local step = 1
local tableCount = #testTable
for key, var in pairs(testTable) do
destStr = destStr..var
if step ~= tableCount then
destStr = destStr..","
end
step = step + 1
end
知道Next之后就简便一些
local testTable ={"1","2","3"}
local destStr = ""
for key, var in pairs(testTable) do
destStr = destStr..var
if next(testTable,key) then
destStr = destStr..","
end
end
print ("destStr==="..destStr)
0 0
- Lua之Next用法
- lua next用法
- lua next 用法
- lua next 用法 table 空的判断
- lua next 用法 table 空的判断
- lua next 用法 table 空的判断
- lua -- next
- lua之select用法
- lua之select用法
- VBS之on error resume next用法
- lua之string.format用法
- Lua之String库用法API
- lua [[ ]] 用法
- last next的用法
- awk中next用法
- 【Lua基础】Lua基本用法
- on error resume next用法
- on error resume next用法
- X+Y返回格式
- Windows下搭建PHP开发环境
- jkjbf
- 队列(数组模拟)
- LeetCode之Linked List Cycle
- Lua之Next用法
- 数据库中将null 替换成 0 或者其他文本
- jhhk
- hdfs shell操作大全
- LeetCode-7 Reverse Integer(倒置整型数)
- OpenCV - 参考网站、牛人博客
- poj3614
- UVA 10815 解题报告
- KVM中Guest OS的调度执行