Sdk/LuaAPI: Make GetBinding() initialize the binding in case it wasn't initialized
This commit is contained in:
parent
6b6608eccc
commit
8f84700628
|
|
@ -24,7 +24,7 @@ namespace Ndk
|
||||||
LuaAPI() = delete;
|
LuaAPI() = delete;
|
||||||
~LuaAPI() = delete;
|
~LuaAPI() = delete;
|
||||||
|
|
||||||
static inline LuaBinding* GetBinding();
|
static LuaBinding* GetBinding();
|
||||||
|
|
||||||
static bool Initialize();
|
static bool Initialize();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,19 +24,6 @@
|
||||||
#include <NDK/Console.hpp>
|
#include <NDK/Console.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Ndk
|
|
||||||
{
|
|
||||||
/*!
|
|
||||||
* \brief Gets the internal binding for Lua
|
|
||||||
* \return A pointer to the binding
|
|
||||||
*/
|
|
||||||
|
|
||||||
inline LuaBinding* LuaAPI::GetBinding()
|
|
||||||
{
|
|
||||||
return s_binding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// This file was automatically generated on 26 May 2014 at 01:05:31
|
// This file was automatically generated on 26 May 2014 at 01:05:31
|
||||||
|
|
||||||
#include <NDK/LuaAPI.hpp>
|
#include <NDK/LuaAPI.hpp>
|
||||||
|
#include <Nazara/Core/ErrorFlags.hpp>
|
||||||
#include <NDK/LuaBinding.hpp>
|
#include <NDK/LuaBinding.hpp>
|
||||||
|
|
||||||
namespace Ndk
|
namespace Ndk
|
||||||
|
|
@ -11,6 +12,21 @@ namespace Ndk
|
||||||
* \brief NDK class that represents the api used for Lua
|
* \brief NDK class that represents the api used for Lua
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Gets the internal binding for Lua
|
||||||
|
* \return A pointer to the binding
|
||||||
|
*/
|
||||||
|
LuaBinding* LuaAPI::GetBinding()
|
||||||
|
{
|
||||||
|
if (!s_binding && !Initialize())
|
||||||
|
{
|
||||||
|
NazaraError("Failed to initialize binding");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_binding;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initializes the LuaAPI module
|
* \brief Initializes the LuaAPI module
|
||||||
* \return true if initialization is successful
|
* \return true if initialization is successful
|
||||||
|
|
@ -30,13 +46,8 @@ namespace Ndk
|
||||||
|
|
||||||
void LuaAPI::RegisterClasses(Nz::LuaInstance& instance)
|
void LuaAPI::RegisterClasses(Nz::LuaInstance& instance)
|
||||||
{
|
{
|
||||||
if (!s_binding && !Initialize())
|
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
|
||||||
{
|
GetBinding()->RegisterClasses(instance);
|
||||||
NazaraError("Failed to initialize binding");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_binding->RegisterClasses(instance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue