Optimize Lua binding

Optimize binding by removing a useless extra indirection and allowing to
move replying variables


Former-commit-id: 76728df1c3ab9a38a4304ae2b9f2fc6a000e0ebb
This commit is contained in:
Lynix
2016-04-24 19:54:46 +02:00
parent 6d66063b2c
commit 24a8fcee01
11 changed files with 190 additions and 107 deletions

View File

@@ -1,6 +1,7 @@
// This file was automatically generated on 26 May 2014 at 01:05:31
#include <NDK/LuaBinding.hpp>
#include <Nazara/Core/MemoryHelper.hpp>
#include <NDK/LuaAPI.hpp>
namespace Ndk
@@ -10,10 +11,7 @@ namespace Ndk
/*********************************** Nz::Music **********************************/
musicClass.Inherit(soundEmitter);
musicClass.SetConstructor([] (Nz::LuaInstance& lua) -> Nz::Music*
{
return new Nz::Music;
});
musicClass.BindDefaultConstructor();
//musicClass.SetMethod("Create", &Nz::Music::Create);
//musicClass.SetMethod("Destroy", &Nz::Music::Destroy);
@@ -51,10 +49,7 @@ namespace Ndk
/*********************************** Nz::Sound **********************************/
soundClass.Inherit(soundEmitter);
soundClass.SetConstructor([] (Nz::LuaInstance& lua) -> Nz::Sound*
{
return new Nz::Sound;
});
soundClass.BindDefaultConstructor();
soundClass.BindMethod("GetBuffer", &Nz::Sound::GetBuffer);
@@ -79,9 +74,10 @@ namespace Ndk
});
/*********************************** Nz::SoundBuffer **********************************/
soundBuffer.SetConstructor([] (Nz::LuaInstance& lua) -> Nz::SoundBufferRef*
soundBuffer.SetConstructor([] (Nz::LuaInstance& lua, Nz::SoundBufferRef* instance)
{
return new Nz::SoundBufferRef(new Nz::SoundBuffer);
Nz::PlacementNew(instance, Nz::SoundBuffer::New());
return true;
});
soundBuffer.BindMethod("Destroy", &Nz::SoundBuffer::Destroy);