Refactor LuaInstance to prepare coroutine handling

This commit is contained in:
Jérôme Leclercq
2017-06-07 21:18:07 +02:00
parent b7df3bd1c4
commit a8129b218b
34 changed files with 2635 additions and 2594 deletions

View File

@@ -22,7 +22,7 @@ namespace Ndk
utility = LuaBinding_Base::BindUtility(*this);
#ifndef NDK_SERVER
audio = LuaBinding_Base::BindAudio(*this);
audio = LuaBinding_Base::BindAudio(*this);
renderer = LuaBinding_Base::BindRenderer(*this);
graphics = LuaBinding_Base::BindGraphics(*this);
#endif
@@ -36,31 +36,31 @@ namespace Ndk
* \param instance Lua instance that will interact with the engine & SDK
*/
void LuaBinding::RegisterClasses(Nz::LuaInstance& instance)
void LuaBinding::RegisterClasses(Nz::LuaState& state)
{
core->Register(instance);
math->Register(instance);
network->Register(instance);
sdk->Register(instance);
utility->Register(instance);
core->Register(state);
math->Register(state);
network->Register(state);
sdk->Register(state);
utility->Register(state);
#ifndef NDK_SERVER
audio->Register(instance);
graphics->Register(instance);
renderer->Register(instance);
audio->Register(state);
graphics->Register(state);
renderer->Register(state);
#endif
// ComponentType (fake enumeration to expose component indexes)
instance.PushTable(0, m_componentBinding.size());
state.PushTable(0, m_componentBinding.size());
{
for (const ComponentBinding& entry : m_componentBinding)
{
if (entry.name.IsEmpty())
continue;
instance.PushField(entry.name, entry.index);
state.PushField(entry.name, entry.index);
}
}
instance.SetGlobal("ComponentType");
state.SetGlobal("ComponentType");
}
}