diff --git a/include/openspace/properties/scalar/uintproperty.h b/include/openspace/properties/scalar/uintproperty.h index b004d15e31..22b1abfd32 100644 --- a/include/openspace/properties/scalar/uintproperty.h +++ b/include/openspace/properties/scalar/uintproperty.h @@ -45,6 +45,9 @@ public: int typeLua() const override; using TemplateProperty::operator=; + +private: + unsigned int fromLuaConversion(lua_State* state) const override; }; } // namespace openspace::properties diff --git a/src/properties/scalar/uintproperty.cpp b/src/properties/scalar/uintproperty.cpp index b823aa5e3a..dbcb5b7403 100644 --- a/src/properties/scalar/uintproperty.cpp +++ b/src/properties/scalar/uintproperty.cpp @@ -48,4 +48,16 @@ int UIntProperty::typeLua() const { return LUA_TNUMBER; } +unsigned int UIntProperty::fromLuaConversion(lua_State* state) const { + if (ghoul::lua::hasValue(state)) { + return static_cast(ghoul::lua::value(state)); + } + else if (ghoul::lua::hasValue(state)) { + return ghoul::lua::value(state); + } + else { + throw ghoul::RuntimeError(fmt::format("Error extracting value in UIntProperty")); + } +} + } // namespace openspace::properties