summaryrefslogtreecommitdiff
path: root/Source/3rdParty/Luax/luax_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/3rdParty/Luax/luax_state.h')
-rw-r--r--Source/3rdParty/Luax/luax_state.h41
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ĵַز
///