Simplify property handling; Fix unit tests

This commit is contained in:
Alexander Bock
2023-03-11 15:58:40 +01:00
parent 27aeac0776
commit 3df65ae899
8 changed files with 14 additions and 34 deletions

View File

@@ -199,10 +199,8 @@ public:
* no-op.
*
* \param state The Lua state from which the value will be decoded
* \return `true` if the decoding and setting of the value succeeded, `false`
* otherwise
*/
virtual bool setLuaValue(lua_State* state);
virtual void setLuaValue(lua_State* state);
/**
* Returns the Lua type that will be put onto the stack in the Property::getLua method

View File

@@ -115,7 +115,7 @@ public:
* \param state The Lua state from which the value will be decoded
* \return `true` if the decoding succeeded; `false` otherwise
*/
virtual bool setLuaValue(lua_State* state) override;
virtual void setLuaValue(lua_State* state) override;
/// \see Property::typeLua
virtual int typeLua() const override = 0;

View File

@@ -85,15 +85,9 @@ bool TemplateProperty<T>::getLuaValue(lua_State* state) const {
}
template <typename T>
bool TemplateProperty<T>::setLuaValue(lua_State* state) {
try {
T thisValue = fromLuaConversion(state);
set(std::any(thisValue));
return true;
}
catch (const ghoul::lua::LuaFormatException&) {
return false;
}
void TemplateProperty<T>::setLuaValue(lua_State* state) {
T thisValue = fromLuaConversion(state);
set(std::any(thisValue));
}
template <typename T>

View File

@@ -57,7 +57,7 @@ public:
* \param state The unused Lua state
* \return Returns always `true`
*/
bool setLuaValue(lua_State* state) override;
void setLuaValue(lua_State* state) override;
/**
* Silently ignores any value that is passed into this function and will trigger the