博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iterator
阅读量:7094 次
发布时间:2019-06-28

本文共 485 字,大约阅读时间需要 1 分钟。

  hot3.png

function iterator (state)

while state.line do -- repeat while there are lines

-- search for next word

local s, e = string.find(state.line, "%w+", state.pos)

if s then -- found a word?

-- update next position (after this word)

state.pos = e + 1

return string.sub(state.line, s, e)

else -- word not found

state.line = io.read() -- try next line...

state.pos = 1 -- ... from first position

end

end

return nil -- no more lines: end loop

end

转载于:https://my.oschina.net/540287555/blog/193672

你可能感兴趣的文章
TCP/IP协议族-四层网络模型(真正的实现不是7层)
查看>>
负载均衡之后的如何让应用程序获取客户端真实IP
查看>>
Integer对象的一些误解
查看>>
ubuntu下添加新用户,踢出在线用户
查看>>
chattr和lsattr命令详解
查看>>
是时候升级到 vSphere 5.1 了!
查看>>
烂泥:通过binlog恢复mysql备份之前的数据
查看>>
烂泥:源码安装apache
查看>>
apache-安全加固
查看>>
塞尔校园先锋,教育优惠
查看>>
Oracle 物化视图
查看>>
Mybatis Mapper.xml 配置文件中 resultMap 节点的源码解析
查看>>
Hadoop
查看>>
【Unity】手游资源热更新策略探讨
查看>>
没有任何技术含量的一片日志
查看>>
我的友情链接
查看>>
android开发--RelativeLayout用到的一些重要的属性
查看>>
Oracle大表数据排序后分页查询效率很慢
查看>>
JFBlog 1.0 发布,基于 JFinal 的 Java 轻博客
查看>>
RHEL6配置Kdump
查看>>