SweetDream
高歌一壶新酿酒,醉抱青山不必归。

随笔分类 -  Lua

Lua 与 C 交互(2)
摘要:1.new tbClass{}, Binding "FunName" to C function "thunk" and set it's closure with upvalue; 2.rigister metatable "Class", and set metatable __index to table"tbClass" 3.new pObj, new userdata to point ... 阅读全文
posted @ 2008-10-15 15:01 SweetDream 阅读(642) 评论(0) 推荐(0)
Lua 与 C 交互(1)
摘要:lua_newtable void lua_newtable (lua_State *L); 创建一个空 table ,并将之压入堆栈。 它等价于 lua_createtable(L, 0, 0) 。 lua_gettop int lua_gettop (lua_State *L); 返回栈顶元素的索引。 因为索引是从 1 开始编号的, 所以这个结果等于堆栈上的元素个数(因此返回 0 表示堆... 阅读全文
posted @ 2008-10-14 08:35 SweetDream 阅读(7436) 评论(0) 推荐(0)