Skip to content

Commit

Permalink
Remove cv qualifiers in pi_lua_generic calls
Browse files Browse the repository at this point in the history
When binding a function taking a const parameter, previously this would
accidentally generate LuaObject<Body const> which was a different
template than LuaObject<Body>.

This commit fixes that behavior by removing any cv specifiers from the
template parameter used by LuaObject.
  • Loading branch information
sturnclaw committed May 21, 2020
1 parent c148c97 commit 2ed0862
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lua/LuaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ template <class T>
void pi_lua_generic_pull(lua_State *l, int index, T *&out)
{
assert(l == Lua::manager->GetLuaState());
out = LuaObject<T>::CheckFromLua(index);
out = LuaObject<typename std::remove_cv<T>::type>::CheckFromLua(index);
}

template <class T>
bool pi_lua_strict_pull(lua_State *l, int index, T *&out)
{
assert(l == Lua::manager->GetLuaState());
out = LuaObject<T>::GetFromLua(index);
out = LuaObject<typename std::remove_cv<T>::type>::GetFromLua(index);
return out != 0;
}

Expand All @@ -445,7 +445,7 @@ void pi_lua_generic_push(lua_State *l, T *value)
{
assert(l == Lua::manager->GetLuaState());
if (value)
LuaObject<T>::PushToLua(value);
LuaObject<typename std::remove_cv<T>::type>::PushToLua(value);
else
lua_pushnil(l);
}
Expand Down

0 comments on commit 2ed0862

Please sign in to comment.