Sfoglia il codice sorgente

Add LuaLoader::Find() helper to find the state’s loader.

undefined
Sam Hocevar 8 anni fa
parent
commit
bd96cfeb51
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. +9
    -0
      src/lolua/baselua.cpp
  2. +1
    -0
      src/lolua/baselua.h

+ 9
- 0
src/lolua/baselua.cpp Vedi File

@@ -133,6 +133,15 @@ void Loader::Release(LuaState* l, Lolua::Loader* loader)
} }
} }


Lolua::Loader *LuaLoader::Find(LuaState* l)
{
for (int i = 0; i < g_loaders.count(); ++i)
if (g_loaders[i].m1 == l)
return g_loaders[i].m2;

return nullptr;
}

//Store lua object -------------------------------------------------------- //Store lua object --------------------------------------------------------
void Loader::StoreObject(LuaState* l, Object* obj) void Loader::StoreObject(LuaState* l, Object* obj)
{ {


+ 1
- 0
src/lolua/baselua.h Vedi File

@@ -995,6 +995,7 @@ public:
protected: protected:
LuaState* GetLuaState(); LuaState* GetLuaState();
static void Store(LuaState* l, Loader* loader); static void Store(LuaState* l, Loader* loader);
static Loader *Find(LuaState* l);
static void Release(LuaState* l, Loader* loader); static void Release(LuaState* l, Loader* loader);
static void StoreObject(LuaState* l, Object* obj); static void StoreObject(LuaState* l, Object* obj);
//Virtual Store lua object ------------------------------------------------ //Virtual Store lua object ------------------------------------------------


Caricamento…
Annulla
Salva