如果我有一個全局表Table
具有功能getValue()
,setValue()
,等我可以存儲Table.getValue
參考或做我必須存儲Table
的引用,然後調用成員函數?的Lua - 引用函數中的表
lua_getglobal(L, "Table");
lua_getfield(L, -1, "getValue");
getValueRef = luaL_ref(L, LUA_REGISTRYINDEX);
lua_getfield(L, -1, "setValue");
setValueRef = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pop(L, 1); // Pop "Table" off of the stack
我曲解LUA手動從來沒有停止給我帶來驚喜的能力。謝謝。 – Mastax 2012-04-26 02:43:56