lua_State* m_state;
luaL_newmetatable(m_state,LUA_DATACLIENT);
lua_pushcfunction(m_state,DataClient_Index);
lua_setfield(m_state,-2,"__index");
lua_pushcfunction(m_state,DataClient_newIndex);
lua_setfield(m_state,-2,"__newindex");
lua_pushcfunction(m_state,DataClient_RequestData);
lua_setfield(m_state,-2,"RequestData");
lua_pushcfunction(m_state,DataClient_free);
lua_setfield(m_state,-2,"__gc");
lua_pop(m_state,1);
我想将一些C函数导出到Lua,但是DataClient_Index
当我在Lua中调用时调用了该函数RequestData
,那么为什么在Lua中使用索引方法而不是特殊方法?