您的位置:首页 > 编程语言 > Lua

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: