Lua placement new fixups

This commit is contained in:
Celtic Minstrel 2016-08-26 17:13:09 -04:00
parent b5c5e21895
commit 27b0fe6d7b
2 changed files with 3 additions and 2 deletions

View file

@ -21,6 +21,7 @@
#include "lua/lauxlib.h"
#include "lua/lua.h"
#include "scripting/lua_common.hpp" // for new(L)
static lg::log_domain log_scripting_lua("scripting/lua");
#define DBG_LUA LOG_STREAM(debug, log_scripting_lua)
@ -83,9 +84,8 @@ void register_metatable ( lua_State* L )
void push_function( lua_State* L, const lua_function & f )
{
void * p = lua_newuserdata(L, sizeof(lua_function));
new(L) lua_function(f);
luaL_setmetatable(L, cpp_function);
new (p) lua_function(f);
}
void set_functions( lua_State* L, const std::vector<lua_cpp::Reg>& functions)

View file

@ -17,6 +17,7 @@
#include "log.hpp"
#include "mt_rng.hpp"
#include "lua_kernel_base.hpp"
#include "lua_common.hpp" // for new(L)
#include <new>
#include <string>