summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/LuaBindVM.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-11-15 11:56:49 +0800
committerchai <chaifix@163.com>2020-11-15 11:56:49 +0800
commit7270cd95294d53180641b05784258df1e29f90d2 (patch)
tree171554d5caed0adea988c785d3714d08595ba1f3 /Runtime/Scripting/LuaBindVM.cpp
parentd2e4b2839bc7ce874370ff4c52dcfdadf666ff52 (diff)
*lua BindToLua
Diffstat (limited to 'Runtime/Scripting/LuaBindVM.cpp')
-rw-r--r--Runtime/Scripting/LuaBindVM.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/Runtime/Scripting/LuaBindVM.cpp b/Runtime/Scripting/LuaBindVM.cpp
index ce68a80..b50a5e1 100644
--- a/Runtime/Scripting/LuaBindVM.cpp
+++ b/Runtime/Scripting/LuaBindVM.cpp
@@ -4,9 +4,9 @@
namespace LuaBind
{
- LuaBindVM::VMap LuaBindVM::VMs; // 通过线程查找虚拟机,为了方便
+ VM::VMap VM::VMs; // 通过线程查找虚拟机,为了方便
- LuaBindVM* LuaBindVM::TryGetVM(global_State* gState)
+ VM* VM::TryGetVM(global_State* gState)
{
auto it = VMs.find(gState);
if (it != VMs.end())
@@ -15,12 +15,12 @@ namespace LuaBind
return nullptr;
}
- LuaBindVM* LuaBindVM::TryGetVM(lua_State* state)
+ VM* VM::TryGetVM(lua_State* state)
{
return TryGetVM(G(state));
}
- LuaBindVM::LuaBindVM()
+ VM::VM()
: mStrongRefTable()
, mWeakRefTable()
{
@@ -28,17 +28,17 @@ namespace LuaBind
assert(mMainThread);
mGlobalState = G(mMainThread);
- VMs.insert(std::pair<global_State*, LuaBindVM*>(mGlobalState, this));
+ VMs.insert(std::pair<global_State*, VM*>(mGlobalState, this));
}
- LuaBindVM::~LuaBindVM()
+ VM::~VM()
{
VMs.erase(mGlobalState);
lua_close(mMainThread);
}
// 初始化context
- void LuaBindVM::Setup()
+ void VM::Setup()
{
LUA_BIND_STATE(mMainThread);
@@ -46,29 +46,29 @@ namespace LuaBind
mWeakRefTable.Init(state, "_LUA_BIND_WEAKREF_TABLE", "v");
}
- lua_State* LuaBindVM::CreateThread()
+ lua_State* VM::CreateThread()
{
lua_State* thread = lua_newthread(mMainThread);
assert(thread);
return thread;
}
- lua_State* LuaBindVM::GetMainThread()
+ lua_State* VM::GetMainThread()
{
return mMainThread;
}
- LuaBindState LuaBindVM::GetMainState()
+ State VM::GetMainState()
{
return mMainThread;
}
- LuaBindRefTable& LuaBindVM::GetStrongRefTable()
+ RefTable& VM::GetStrongRefTable()
{
return mStrongRefTable;
}
- LuaBindRefTable& LuaBindVM::GetWeakRefTable()
+ RefTable& VM::GetWeakRefTable()
{
return mWeakRefTable;
}