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;
|
||||
|
||||
static inline LuaBinding* GetBinding();
|
||||
static LuaBinding* GetBinding();
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
|
|
|
|||
|
|
@ -24,19 +24,6 @@
|
|||
#include <NDK/Console.hpp>
|
||||
#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
|
||||
{
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// This file was automatically generated on 26 May 2014 at 01:05:31
|
||||
|
||||
#include <NDK/LuaAPI.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <NDK/LuaBinding.hpp>
|
||||
|
||||
namespace Ndk
|
||||
|
|
@ -11,6 +12,21 @@ namespace Ndk
|
|||
* \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
|
||||
* \return true if initialization is successful
|
||||
|
|
@ -30,13 +46,8 @@ namespace Ndk
|
|||
|
||||
void LuaAPI::RegisterClasses(Nz::LuaInstance& instance)
|
||||
{
|
||||
if (!s_binding && !Initialize())
|
||||
{
|
||||
NazaraError("Failed to initialize binding");
|
||||
return;
|
||||
}
|
||||
|
||||
s_binding->RegisterClasses(instance);
|
||||
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
|
||||
GetBinding()->RegisterClasses(instance);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue