Skip to content

Commit

Permalink
AI/Lua Object: deployed more std::make_shared
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz authored and GregoryLundberg committed Nov 30, 2017
1 parent b6f9e9b commit 22bb91e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ai/lua/lua_object.hpp
Expand Up @@ -84,25 +84,25 @@ class lua_object : public lua_object_base
template <>
inline std::shared_ptr<double> lua_object<double>::to_type(lua_State *L, int n)
{
return std::shared_ptr<double>(new double(lua_tonumber(L, n)));
return std::make_shared<double>(lua_tonumber(L, n));
}

template <>
inline std::shared_ptr<std::string> lua_object<std::string>::to_type(lua_State *L, int n)
{
return std::shared_ptr<std::string>(new std::string(lua_tostring(L, n)));
return std::make_shared<std::string>(lua_tostring(L, n));
}

template <>
inline std::shared_ptr<bool> lua_object<bool>::to_type(lua_State *L, int n)
{
return std::shared_ptr<bool>(new bool(luaW_toboolean(L, n)));
return std::make_shared<bool>(luaW_toboolean(L, n));
}

template <>
inline std::shared_ptr<int> lua_object<int>::to_type(lua_State *L, int n)
{
return std::shared_ptr<int>(new int(static_cast<int>(lua_tointeger(L, n))));
return std::make_shared<int>(static_cast<int>(lua_tointeger(L, n)));
}

template <>
Expand Down

0 comments on commit 22bb91e

Please sign in to comment.