Lua upvalue
2016-02-17 18:56
411 查看
Another word for an upvalue in Lua is an external
local variable. When you write a new function in Lua, it can access any of the local variables that have the same scope as it. That
function 'closes' over those local variables which is why it's called a closure.
The local variable that has been closed over by that function 'jumps up' into the new scope which is why it's called an upvalue.
https://www.quora.com/Lua-programming-language/What-are-upvalues-in-Lua
lua官网的这个解释更清晰一些
http://www.lua.org/pil/27.3.3.html
local variable. When you write a new function in Lua, it can access any of the local variables that have the same scope as it. That
function 'closes' over those local variables which is why it's called a closure.
The local variable that has been closed over by that function 'jumps up' into the new scope which is why it's called an upvalue.
https://www.quora.com/Lua-programming-language/What-are-upvalues-in-Lua
lua官网的这个解释更清晰一些
http://www.lua.org/pil/27.3.3.html
相关文章推荐
- lua中的require机制
- Lua学习笔记-9.3章-协同用做迭代器
- Lua学习笔记-9.2章-管道和过滤器
- 快速掌握Lua 5.3 —— "table"库
- Lua学习笔记-9.1章-协同程序
- Lua学习笔记
- 灵光乍现,lua数据绑定
- java常用算法之逆波兰表达式(Evaluate Reverse Polish Notation)
- Lua C API 遍历 table
- mac上安装lua
- lua语言介绍
- windows平台编译Lua
- Lua table用法
- Lua学习笔记-迭代器和泛型for
- Lua string用法
- Lua string.format用法
- 快速掌握Lua 5.3 —— "Weak Tables"以及数学库
- lua三目运算符陷阱
- PropertyAnimation属性动画资源 ArgbEvaluator使用
- luabinding 中用Scrollview实现pageview的翻页效果