diff options
| author | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 | 
|---|---|---|
| committer | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 | 
| commit | 0c391fdbce5a079cf03e483eb6174dd47806163d (patch) | |
| tree | b06cd7a9d0ae0d9bb9e82f3dcb786dfce11f8628 /Source/external/Luax/luax_vm.h | |
| parent | 9686368e58e25cbd6dc37d686bdd2be3f80486d6 (diff) | |
*misc
Diffstat (limited to 'Source/external/Luax/luax_vm.h')
| -rw-r--r-- | Source/external/Luax/luax_vm.h | 63 | 
1 files changed, 63 insertions, 0 deletions
| diff --git a/Source/external/Luax/luax_vm.h b/Source/external/Luax/luax_vm.h new file mode 100644 index 0000000..3eda3f8 --- /dev/null +++ b/Source/external/Luax/luax_vm.h @@ -0,0 +1,63 @@ +#ifndef __LUAX_CONTEXT_H__ +#define __LUAX_CONTEXT_H__ + +#include <map> +#include <unordered_set> + +#include "luax_ref.h" +#include "luax_config.h" +#include "luax_state.h" +#include "luax_globalstate.h" + +namespace Luax +{ + +	/// +	/// lua_stateصcontextһϵдļϣҲûϵҪΪ˽Լڴ档 +	/// +	class LuaxVM +	{ +	public: + +		/// +		/// global_Stateõ +		/// +		static LuaxVM* TryGetVM(global_State* gState); +		static LuaxVM* TryGetVM(lua_State* state); + +		LuaxVM(); +		~LuaxVM(); + +		/// +		/// ҪֶSetupʼһЩ״̬ +		/// +		void Setup(); + +		lua_State* GetMainThread(); +		lua_State* CreateThread(); +		LuaxState GetMainState(); + +		LuaxRefTable& GetStrongRefTable(); +		LuaxRefTable& GetWeakRefTable(); + +	private: + +		typedef std::map<global_State*, LuaxVM*> VMap; + +		static VMap VMs;               // ͨglobal_StateΪ˷ + +		LuaxRefTable  mStrongRefTable; // _LUAX_STRONGREF_TABLE +		LuaxRefTable  mWeakRefTable;   // _LUAX_WEAKREF_TABLE + +		global_State* mGlobalState;    // global_Stateɵǰ̹߳ +		lua_State*    mMainThread;     // ߳ + +#if LUAX_PROFILER +		size_t        mObjectCount;    // ͳڴдʵ +#endif + +	}; + +} + +#endif
\ No newline at end of file | 
