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_reftable.h | |
parent | 9eba034f5c2ffd49f33d38c283b24230f9e362e0 (diff) |
*luax
Diffstat (limited to 'Source/3rdParty/Luax/luax_reftable.h')
-rw-r--r-- | Source/3rdParty/Luax/luax_reftable.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Source/3rdParty/Luax/luax_reftable.h b/Source/3rdParty/Luax/luax_reftable.h new file mode 100644 index 0000000..0ba42f7 --- /dev/null +++ b/Source/3rdParty/Luax/luax_reftable.h @@ -0,0 +1,65 @@ +#ifndef __LUAX_REFTABLE_H__ +#define __LUAX_REFTABLE_H__ + +#include "luax_config.h" + +namespace Luax +{ + + class LuaxState; + + /// + /// ref table strong ref tableweak ref tabletableĴ + /// + class LuaxRefTable + { + public: + + enum + { + WEAK_KEY = 1, + WEAK_VALUE = 1 << 1 + }; + + LuaxRefTable(); + ~LuaxRefTable(); + + void Init(LuaxState& state, cc8* name, cc8* mode = nullptr); + + bool IsKeyWeak(); + bool IsValueWeak(); + + /// + /// stack[idx]ʵڴref tableһãrefID + /// + int Ref(LuaxState& state, int idx); + void Unref(LuaxState& state, int refID); + + /// + /// ref table ջ + /// + void PushRefTable(LuaxState& state); + + /// + /// reftable[refID] ջ + /// + void PushRef(LuaxState& state, int refID); + + /// + /// ref tableLUA_REGISTRYINDEX[mName] + /// + void Clear(LuaxState& state); + + private: + + friend class LuaxState; + + lua_State* mState; // һЩȷϹ + cc8* mName; // ref table + int mMode; // ref table + + }; + +} + +#endif
\ No newline at end of file |