diff options
author | chai <chaifix@163.com> | 2019-03-12 23:08:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-12 23:08:31 +0800 |
commit | 6016ece202eef94ed76bd20d4f7879ccc71cc2e6 (patch) | |
tree | da0d0be011ee24489174bde1ec1c436ce7aaa1b2 /Source/3rdParty/Luax/luax_state.h | |
parent | 9eba034f5c2ffd49f33d38c283b24230f9e362e0 (diff) |
*luax
Diffstat (limited to 'Source/3rdParty/Luax/luax_state.h')
-rw-r--r-- | Source/3rdParty/Luax/luax_state.h | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/Source/3rdParty/Luax/luax_state.h b/Source/3rdParty/Luax/luax_state.h index 52b8f38..6a688b6 100644 --- a/Source/3rdParty/Luax/luax_state.h +++ b/Source/3rdParty/Luax/luax_state.h @@ -4,33 +4,37 @@ #include <string> #include "lua.hpp" +#include "luax_reftable.h" #include "luax_config.h" namespace Luax { + class Context; class LuaxClass; /// /// lua_StateĴ˱һlua_Stateòݡһʵmetatable£ - /// interface table - /// member table - /// ref table - /// userdata + /// interface table + /// member table + /// ref table + /// userdata /// userdataͨgetmetatableȡϼmetatable֮һclass tableעڶӦƿռ /// LUAX_API class LuaxState { public: - LuaxState(lua_State* state); - ~LuaxState(); - operator lua_State*(); operator bool(); lua_State* operator ->(); lua_State& operator *(); - + + /// + /// ȡlua_State + /// + lua_State* GetHandle(); + //------------------------------------------------------------------------------------------------------------ void OpenLibs(); @@ -82,7 +86,7 @@ namespace Luax bool HasField(int idx, int name, int type); bool HasKeys(int idx); - void Push(); + void PushNil(); void Push(bool value); void Push(cc8* value); void Push(double value); @@ -103,6 +107,13 @@ namespace Luax void Pop(int n = 1); + void Settop(int idx); + + //------------------------------------------------------------------------------------------------------------ + // õĹregister[LUAX_STRONG_REFTABLE]register[LUAX_WEAK_REFTABLE] + + void Ref(); + //------------------------------------------------------------------------------------------------------------ template<typename T> T GetValue(int idx, T default_value); @@ -121,17 +132,21 @@ namespace Luax /// /// עṤͨ࣬New /// - template<typename T> - void RegisterFactory(); + template<typename T> void RegisterFactory(); /// /// עᵥûNew /// - template<typename T> - void RegisterSingleton(); + template<typename T> void RegisterSingleton(); private: + friend class Context; + + LuaxState(lua_State* state); + LuaxState(const LuaxState& state); + ~LuaxState(); + /// /// ζLuaxStateĵַز /// |