diff options
author | chai <chaifix@163.com> | 2019-06-06 00:11:18 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-06-06 00:11:18 +0800 |
commit | 88b882ed0b432c6aff2063213e2f793a36dd25f7 (patch) | |
tree | 5fe5d5334050e1a1146aa63e61e88aa2f5170727 /source/3rd-party/Luax/luax_ref.cpp | |
parent | f6c0498c9728a286c13980ed3b60763d02e1b3a0 (diff) |
*misc
Diffstat (limited to 'source/3rd-party/Luax/luax_ref.cpp')
-rw-r--r-- | source/3rd-party/Luax/luax_ref.cpp | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/source/3rd-party/Luax/luax_ref.cpp b/source/3rd-party/Luax/luax_ref.cpp deleted file mode 100644 index d4be775..0000000 --- a/source/3rd-party/Luax/luax_ref.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "luax_vm.h" -#include "luax_ref.h" - -namespace Luax -{ - - LuaxRef::LuaxRef(int mode) - : mRefID(LUA_NOREF) - , mMode(mode) - { - } - - LuaxRef::~LuaxRef() - { - } - - LuaxRef::operator bool() - { - return (mRefID != LUA_NOREF); - } - - bool LuaxRef::PushRef(LuaxState& state) - { - assert(mRefID != LUA_NOREF); - - LuaxVM* vm = state.GetVM(); - if (!vm) return false; - if (mMode == STRONG_REF) - { - LuaxRefTable& table = vm->GetStrongRefTable(); - table.PushRef(state, mRefID); - } - else if (mMode == WEAK_REF) - { - LuaxRefTable& table = vm->GetWeakRefTable(); - table.PushRef(state, mRefID); - } - else - { - state.PushNil(); - return false; - } - return true; - } - - void LuaxRef::SetRef(LuaxState& state, int idx) - { - LuaxVM* vm = state.GetVM(); - if (!vm) return; - if (mMode == STRONG_REF) - { - LuaxRefTable& table = vm->GetStrongRefTable(); - mRefID = table.Ref(state, idx); - } - else if (mMode == WEAK_REF) - { - LuaxRefTable& table = vm->GetWeakRefTable(); - mRefID = table.Ref(state, idx); - } - } - - LuaxStrongRef::LuaxStrongRef() - : LuaxRef(STRONG_REF) - { - } - - LuaxWeakRef::LuaxWeakRef() - : LuaxRef(WEAK_REF) - { - } - -} |