lua_pushvalue[-0, +1, -]void lua_pushvalue (lua_State *L, int index);Pushes a copy of the element at the given valid index onto the stack如上所述, lua_pushvalue(L, -4) 并不是往栈顶插入元素-4, 而是把在栈中位置为-4的元素copy之后插入于栈顶中!!!
posted @ 2013-04-15 16:17
Nick Yang
阅读(5989)评论(0)推荐(0)
编辑
摘要:
关于ipairs()和pairs(),Lua官方手册是这样说明的:pairs (t)If t has a metamethod __pairs, calls it with t as argument and returns the first three results from the call.Otherwise, returns three values: the next function, the table t, and nil, so that the construction for k,v in pairs(t) do body endwill iterate ov... 阅读全文
posted @ 2013-03-13 10:45
Nick Yang
阅读(6277)评论(1)推荐(0)
编辑