summaryrefslogtreecommitdiff
path: root/source/3rd-party
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party')
-rw-r--r--source/3rd-party/Luax/luax_class.hpp4
-rw-r--r--source/3rd-party/Luax/luax_config.h4
-rw-r--r--source/3rd-party/Luax/luax_state.h37
3 files changed, 41 insertions, 4 deletions
diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp
index af52b5f..cfac2a5 100644
--- a/source/3rd-party/Luax/luax_class.hpp
+++ b/source/3rd-party/Luax/luax_class.hpp
@@ -81,6 +81,10 @@ namespace Luax
///
virtual bool PushLuaxMemberRef(LuaxState& state, int refID) { assert(false); return false; };
+ virtual bool PushLuaxUserdata(LuaxState& state) { assert(false); return false; };
+ virtual bool PushLuaxMemberTable(LuaxState& state) { assert(false); return false; };
+ virtual bool PushLuaxRefTable(LuaxState& state) { assert(false); return false; };
+
};
///
diff --git a/source/3rd-party/Luax/luax_config.h b/source/3rd-party/Luax/luax_config.h
index d95ae8b..0ace00b 100644
--- a/source/3rd-party/Luax/luax_config.h
+++ b/source/3rd-party/Luax/luax_config.h
@@ -52,8 +52,8 @@ namespace Luax
#define LUAX_ENABLE_NATIVE_EXTEND 0
-#define LUAX_ENABLE_PLAIN_CLASS 1
-#define LUAX_ENABLE_PLAIN_ENUM 1
+#define LUAX_ENABLE_PLAIN_CLASS 0
+#define LUAX_ENABLE_PLAIN_ENUM 0
}
diff --git a/source/3rd-party/Luax/luax_state.h b/source/3rd-party/Luax/luax_state.h
index 20d5189..e9c394a 100644
--- a/source/3rd-party/Luax/luax_state.h
+++ b/source/3rd-party/Luax/luax_state.h
@@ -193,13 +193,13 @@ namespace Luax
//------------------------------------------------------------------------------------------------------------
- private:
+ protected:
friend class LuaxContext;
LuaxState(lua_State* state);
LuaxState(const LuaxState& state);
- ~LuaxState();
+ virtual ~LuaxState();
///
/// ζLuaxStateĵַز
@@ -258,6 +258,39 @@ namespace Luax
#define LUAX_STATE(L) \
Luax::LuaxState& state = Luax::LuaxRuntime::Get().GetLuaxState(L)
+ //--------------------------------------------------------------------------------------------------------------
+
+ ///
+ /// ȷȫluaܹڵ֮󷵻صstack״̬
+ ///
+ class LuaxScopedState
+ : public LuaxState
+ {
+ public:
+ LuaxScopedState(lua_State* state)
+ : LuaxState(state)
+ {
+ mRestoreTop = lua_gettop(mState);
+ }
+ LuaxScopedState(const LuaxState& state)
+ : LuaxState(state)
+ {
+ mRestoreTop = lua_gettop(mState);
+ }
+ ~LuaxScopedState()
+ {
+ if (mState) {
+ if (lua_gettop(mState) != mRestoreTop) {
+ lua_settop(mState, mRestoreTop);
+ }
+ }
+ }
+ private:
+ void* operator new(size_t);
+ int mRestoreTop;
+
+ };
+
}
#endif \ No newline at end of file