Skip to content

Commit

Permalink
Add smart pointers to Lua::Push (multitheftauto#1912)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pirulax authored Dec 14, 2020
1 parent c661810 commit 436ca71
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Shared/mods/deathmatch/logic/lua/LuaBasic.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,17 @@ namespace lua
return 1;
}

template <typename T>
int Push(lua_State* L, const std::shared_ptr<T>& ptr)
{
lua_pushelement(L, ptr.get());
return 1;
}

template <typename T>
int Push(lua_State* L, const std::unique_ptr<T>& ptr)
{
lua_pushelement(L, ptr.get());
return 1;
}
}

0 comments on commit 436ca71

Please sign in to comment.