VE Lua Documentation

Press F to search!

getValues

Definition


-- @/lua/common/settings.lua:98
local function getValues()
  if not valuesCache then
    local values = deepcopy(M.defaultValues)
    local cloudValues = jsonReadFile(M.pathCloud) or {}
    local localValues = jsonReadFile(M.pathLocal) or {}

    values = upgradeSettings(values)
    cloudValues = upgradeSettings(cloudValues)
    localValues = upgradeSettings(localValues)

    tableMerge(values, cloudValues)
    tableMerge(values, localValues)
    if CppSettings then
      for k,value in pairs(values) do
        if CppSettings[k] ~= nil then
          -- we have C++ type information
          if type(CppSettings[k]) ~= type(value) then
            log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
            values[k] = nil
          end
        end
      end
    end
    valuesCache = values
  end
  return valuesCache
end

Callers

@/lua/common/settings.lua
local function getValue(key, defaultValue)
  local value = getValues()[key]
  if value == nil then
@/lua/ge/extensions/core/weather.lua

local function getValues()
  values = {}
  getDiff(presetName)
  getValues()
@/inspector/Test/TestUtilities.js
//
//    object.getValues(arg1, arg2, (callbackArg1, callbackArg2) => {
//        ...
//
//    promisify((cb) => { object.getValues(arg1, arg2, cb); }).then([callbackArg1, callbackArg2]) {
//        ...
//
//    let [callbackArg1, callbackArg2] = await promisify((cb) => { object.getValues(arg1, arg2, cb); });
//
@/lua/ge/extensions/core/settings/settings.lua
  M.impl.invalidateCache()
  local data = M.impl.getValues()