mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 06:49:09 -06:00
Simplify property handling; Fix unit tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user