Compare commits
No commits in common. "6937a3c8287235e3bfd82f607c1f2480831a08e9" and "e4ad298324fd64dc3002421a9f7b72ef8c6b5c5e" have entirely different histories.
6937a3c828
...
e4ad298324
2 changed files with 0 additions and 44 deletions
|
|
@ -1,32 +0,0 @@
|
||||||
--- Utility class for manipulating settings
|
|
||||||
--- @class Settings
|
|
||||||
local Settings = {}
|
|
||||||
|
|
||||||
local settingTypes = { "bool-setting", "int-setting", "double-setting", "string-setting", "color-setting" }
|
|
||||||
|
|
||||||
local function getSetting(name)
|
|
||||||
for _, settingType in pairs(settingTypes) do
|
|
||||||
local setting = data.raw[settingType][name]
|
|
||||||
if setting then return setting end
|
|
||||||
end
|
|
||||||
error("getSetting: Setting with name '" .. name .. "' not found.")
|
|
||||||
end
|
|
||||||
|
|
||||||
Settings.getSetting = getSetting
|
|
||||||
|
|
||||||
function Settings.force(name, value)
|
|
||||||
local setting = getSetting(name)
|
|
||||||
setting.hidden = true
|
|
||||||
if setting.type == "bool-setting" or setting.type == "color-setting" then
|
|
||||||
setting.forced_value = value
|
|
||||||
else
|
|
||||||
setting.allowed_values = { value }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Settings.default(name, value)
|
|
||||||
local setting = getSetting(name)
|
|
||||||
setting.default_value = value
|
|
||||||
end
|
|
||||||
|
|
||||||
return Settings
|
|
||||||
|
|
@ -70,18 +70,6 @@ function table.filter(target, predicate)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Filters a table by removing given key.
|
|
||||||
--- @param target table The table to filter
|
|
||||||
--- @param key string The key to remove
|
|
||||||
function table.filterKey(target, key)
|
|
||||||
return table.filter(
|
|
||||||
target,
|
|
||||||
function(_, currentKey)
|
|
||||||
return currentKey ~= key
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Concatenates two tables into a new table.
|
--- Concatenates two tables into a new table.
|
||||||
--- @param table1 table The first table
|
--- @param table1 table The first table
|
||||||
--- @param table2 table The second table
|
--- @param table2 table The second table
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue