diff options
author | chai <chaifix@163.com> | 2020-11-15 11:56:49 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-11-15 11:56:49 +0800 |
commit | 7270cd95294d53180641b05784258df1e29f90d2 (patch) | |
tree | 171554d5caed0adea988c785d3714d08595ba1f3 /Runtime/Scripting/LuaBindRef.cpp | |
parent | d2e4b2839bc7ce874370ff4c52dcfdadf666ff52 (diff) |
*lua BindToLua
Diffstat (limited to 'Runtime/Scripting/LuaBindRef.cpp')
-rw-r--r-- | Runtime/Scripting/LuaBindRef.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Runtime/Scripting/LuaBindRef.cpp b/Runtime/Scripting/LuaBindRef.cpp index f6ff8a1..00a65d0 100644 --- a/Runtime/Scripting/LuaBindRef.cpp +++ b/Runtime/Scripting/LuaBindRef.cpp @@ -4,35 +4,35 @@ namespace LuaBind { - LuaBindRef::LuaBindRef(int mode) + Ref::Ref(int mode) : mRefID(LUA_NOREF) , mMode(mode) { } - LuaBindRef::~LuaBindRef() + Ref::~Ref() { } - LuaBindRef::operator bool() + Ref::operator bool() { return (mRefID != LUA_NOREF); } - bool LuaBindRef::PushRef(LuaBindState& state) + bool Ref::PushRef(State& state) { assert(mRefID != LUA_NOREF); - LuaBindVM* vm = state.GetVM(); + VM* vm = state.GetVM(); if (!vm) return false; if (mMode == STRONG_REF) { - LuaBindRefTable& table = vm->GetStrongRefTable(); + RefTable& table = vm->GetStrongRefTable(); table.PushRef(state, mRefID); } else if (mMode == WEAK_REF) { - LuaBindRefTable& table = vm->GetWeakRefTable(); + RefTable& table = vm->GetWeakRefTable(); table.PushRef(state, mRefID); } else @@ -43,29 +43,29 @@ namespace LuaBind return true; } - void LuaBindRef::SetRef(LuaBindState& state, int idx) + void Ref::SetRef(State& state, int idx) { - LuaBindVM* vm = state.GetVM(); + VM* vm = state.GetVM(); if (!vm) return; if (mMode == STRONG_REF) { - LuaBindRefTable& table = vm->GetStrongRefTable(); + RefTable& table = vm->GetStrongRefTable(); mRefID = table.Ref(state, idx); } else if (mMode == WEAK_REF) { - LuaBindRefTable& table = vm->GetWeakRefTable(); + RefTable& table = vm->GetWeakRefTable(); mRefID = table.Ref(state, idx); } } - LuaBindStrongRef::LuaBindStrongRef() - : LuaBindRef(STRONG_REF) + StrongRef::StrongRef() + : Ref(STRONG_REF) { } - LuaBindWeakRef::LuaBindWeakRef() - : LuaBindRef(WEAK_REF) + WeakRef::WeakRef() + : Ref(WEAK_REF) { } |