SettingsRegistryUtilFunc.lua 1011 B

123456789101112131415161718192021222324
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. ----------------------------------------------------------------------------------------------------
  9. function GetRequiredStringValue(valueKey, prettyName)
  10. value = g_SettingsRegistry:GetString(valueKey)
  11. if (not value:has_value()) then
  12. Print('FrameTime script missing ' .. tostring(prettyName) .. ' settings registry entry, ending script early')
  13. return false, nil
  14. end
  15. return true, value:value()
  16. end
  17. function GetOptionalUIntValue(valueKey, defaultValue)
  18. return g_SettingsRegistry:GetUInt(valueKey):value_or(defaultValue)
  19. end
  20. function GetOptionalStringValue(valueKey, defaultValue)
  21. return g_SettingsRegistry:GetString(valueKey):value_or(defaultValue)
  22. end