加载中
lua的coroutine 协同程序实现迭代器

reference: http://blog.csdn.net/wzzfeitian/article/details/8832017 下面我们就看一下coroutine为我们提供的强大的功能,用coroutine来实现迭代器。 我们来遍历一个数组的全排列。先看一下...

Lua
2017/02/21 18:07
21
lua的coroutine 协同程序pipes和filters

pipes和filters couroutine的一个典型的例子就是producer-consumer问题。我们来假设有这样两个函数,一个不停的produce一些值出来(例如从一个file中不停地读),另一个不断地consume这些值(...

Lua
2017/02/21 16:07
14
lua的coroutine 协同程序基础

reference: http://www.lua.org/manual/5.3/manual.html 2.6 – Coroutines Lua supports coroutines, also called collaborative multithreading. A coroutine in Lua represents an indep...

lua
2017/02/21 11:37
15
lua metatables中__newindex

reference: http://www.lua.org/manual/5.3/manual.html __newindex: The indexing assignment table[key] = value. Like the index event, this event happens when table is not a table...

lua
2017/02/17 18:35
28
lua metatables中操作__index

reference: http://www.lua.org/manual/5.3/manual.html __index: The indexing access table[key]. This event happens when table is not a table or when key is not present in table. T...

Lua
2017/02/17 16:50
5
lua中print

reference: http://www.lua.org/manual/5.3/manual.html print (···) Receives any number of arguments and prints their values to stdout, using the tostring function to convert ea...

Lua
2017/02/17 15:15
41
lua中metatables和metamethods

reference: http://www.lua.org/manual/5.3/manual.html 2.4 – Metatables and Metamethods Every value in Lua can have a metatable. This metatable is an ordinary Lua table that def...

Lua
2017/02/17 14:37
32
lua中variables和table

reference: http://www.lua.org/manual/5.3/manual.html 3.2 – Variables Variables are places that store values. There are three kinds of variables in Lua: global variables, local...

Lua
2017/02/15 17:44
15
lua的Chunks和block

reference: http://www.lua.org/manual/5.3/manual.html 3.3.1 – Blocks A block is a list of statements, which are executed sequentially: block ::= {stat} Lua has empty statements...

lua
2017/02/14 18:07
12
lua中break和return

reference: http://www.lua.org/manual/5.3/manual.html The break statement terminates the execution of a while, repeat, or for loop, skipping to the next statement after the loo...

lua
2017/02/14 17:35
26
lua中虚变量

使用虚变量(即下划线)来存储丢弃不需要的数值。 例如: function Set (list) local set = {} for _, l in ipairs(list) do print(_,l) end print(set) end Set{"while", "en...

Lua
2017/02/14 17:00
23
lua ipairs(t) and pairs(t)

ipairs(t) and pairs(t) reference: http://www.lua.org/manual/5.3/manual.html ipairs (t) Returns three values (an iterator function, the table t, and 0) so that the construction f...

Lua
2017/02/14 16:44
5
lua字符序列

Lua中的字符串通常表示“一个字符序列”,字符串类型的变量是不可变的。 可以使用单引号或者双引号表示字符串。 还可以使用[[...]]表示字符串。这种形式的字符串可以包含多行也,可以嵌套且不...

lua 基础知识-命令行方式

命令行方式 lua [options] [script [args]] -e:直接将命令传入 Lua prompt> lua -e "print(math.sin(12))" --> -0.53657291800043 -l:加载一个文件. -i:进入交互模式. _PROMPT 内置变量作...

2017/02/09 11:23
27

没有更多内容

加载失败,请刷新页面

返回顶部
顶部