Added memory helpers
This will protect some memory-related code from new redefinition Former-commit-id: 337e69e70acd0bf8dbc3ba1657c6bb0bddfd5df4
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
// This file is part of the "Nazara Engine - Lua scripting module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||
|
||||
#include <Nazara/Lua/LuaInstance.hpp>
|
||||
#include <Lua/lauxlib.h>
|
||||
#include <Lua/lua.h>
|
||||
@@ -11,6 +9,7 @@
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/MemoryStream.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <cstdlib>
|
||||
@@ -621,7 +620,7 @@ void NzLuaInstance::PushCFunction(NzLuaCFunction func, int upvalueCount)
|
||||
void NzLuaInstance::PushFunction(NzLuaFunction func)
|
||||
{
|
||||
NzLuaFunction* luaFunc = reinterpret_cast<NzLuaFunction*>(lua_newuserdata(m_state, sizeof(NzLuaFunction)));
|
||||
new (luaFunc) NzLuaFunction(std::move(func));
|
||||
NzPlacementNew<NzLuaFunction>(luaFunc, std::move(func));
|
||||
|
||||
lua_pushcclosure(m_state, ProxyFunc, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user