diff options
author | chai <chaifix@163.com> | 2019-03-29 08:56:55 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-29 08:56:55 +0800 |
commit | 62085e1b49ce2d8a630373e410812d5c4a9eecc2 (patch) | |
tree | 5b221e36ff35348aaedc041a2a0513f1d0390ecf /source/3rd-party/Luax/luax_runtime.cpp | |
parent | f4c338c63f3456a8eccd56c35e233843687d55be (diff) |
*luax
Diffstat (limited to 'source/3rd-party/Luax/luax_runtime.cpp')
-rw-r--r-- | source/3rd-party/Luax/luax_runtime.cpp | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/source/3rd-party/Luax/luax_runtime.cpp b/source/3rd-party/Luax/luax_runtime.cpp deleted file mode 100644 index dcf7b92..0000000 --- a/source/3rd-party/Luax/luax_runtime.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef __LUAX_RUNTIME_H_ -#define __LUAX_RUNTIME_H_ - -#include "luax_runtime.h" - -using namespace std; - -namespace Luax -{ - - LuaxRuntime* LuaxRuntime::mRuntime = nullptr; - - LuaxRuntime::LuaxRuntime() {}; - LuaxRuntime::~LuaxRuntime() {}; - - LuaxRuntime& LuaxRuntime::Get() - { - if (mRuntime == nullptr) - mRuntime = new LuaxRuntime(); - - return *mRuntime; - } - - lua_State* LuaxRuntime::Open() - { - lua_State* L = lua_open(); - assert(L); - - // 1) - mContexts.insert(pair<lua_State*, LuaxVM*>(L, new LuaxVM(L))); - // 2) ʼcontext - (*this)[L].Setup(); - - return L; - } -/* - lua_State* LuaxRuntime::CreateThread(lua_State* main) - { - lua_State* thread = lua_newthread(main); - mContexts.insert(pair<lua_State*, LuaxVM*>(thread, mContexts[main])); - return thread; - } -*/ - void LuaxRuntime::Close(lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - if (it != mContexts.end()) - { - lua_close(it->second->state); - mContexts.erase(it); - } - } - - bool LuaxRuntime::HasLuaxState(lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - return it != mContexts.end(); - } - - LuaxState& LuaxRuntime::GetLuaxState(lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - if (it != mContexts.end()) - { - return it->second->state; - } - } - - LuaxRefTable& LuaxRuntime::GetStrongRefTable(lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - if (it != mContexts.end()) - { - return it->second->strongRefTable; - } - } - - LuaxRefTable& LuaxRuntime::GetWeaksRefTable(lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - if (it != mContexts.end()) - { - return it->second->weakRefTable; - } - } - - LuaxVM& LuaxRuntime::operator[](lua_State* L) - { - map<lua_State*, LuaxVM*>::iterator it = mContexts.find(L); - assert(it != mContexts.end()); - - return *it->second; - } - -} - -#endif
\ No newline at end of file |