From 4dafefe46a72ba47468b13d011f8299055081b0f Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 22 Oct 2021 23:59:54 +0800 Subject: *LuaBind --- Runtime/Lua/LuaBind/LuaBindVM.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Runtime/Lua/LuaBind/LuaBindVM.h') diff --git a/Runtime/Lua/LuaBind/LuaBindVM.h b/Runtime/Lua/LuaBind/LuaBindVM.h index 3bfe899..37810b9 100644 --- a/Runtime/Lua/LuaBind/LuaBindVM.h +++ b/Runtime/Lua/LuaBind/LuaBindVM.h @@ -3,6 +3,7 @@ #include #include +#include #include "LuaBindRef.h" #include "LuaBindConfig.h" @@ -32,20 +33,22 @@ namespace LuaBind lua_State* CreateThread(); State GetMainState(); - RefTable& GetStrongRefTable(); + RefTable& GetStrongRefTable(); RefTable& GetWeakRefTable(); - private: + int RegisterClassI(State& state, int classID, int index); + void PushClassTable(State& state, int classID); - typedef std::map VMap; + private: + static std::map VMs; // 通过global_State索引虚拟机,为了方便 - static VMap VMs; // 通过global_State索引虚拟机,为了方便 + global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享,保存注册表、管理GC + lua_State* mMainThread; // 主线程 - RefTable mStrongRefTable; // GAMELAB_UNIVERSAL_STRONG_REFERENCE_TABLE - RefTable mWeakRefTable; // GAMELAB_UNIVERSAL_WEAK_REFERENCE_TABLE + RefTable mStrongRefTable; // 全局强引用表 + RefTable mWeakRefTable; // 全局弱引用表 - global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享 - lua_State* mMainThread; // 主线程 + std::unordered_map mClasses; // 类型 #if LUA_BIND_PROFILER size_t mObjectCount; // 统计所有在此虚拟机中创建的实例 -- cgit v1.1-26-g67d0