Support setting multiple keys in config

pull/1232/head
Zef Hemel 2025-02-06 08:37:09 +01:00
parent 12d5f0beba
commit ac18443b53
1 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,14 @@ function config.define(key, schema)
config_schema[key] = schema or true
end
function config.set(key, value)
function config.set(keyOrTable, value)
if type(keyOrTable) == "table" then
for key, value in pairs(keyOrTable) do
config.set(key, value)
end
return
end
local key = keyOrTable
local schema = config_schema[key]
if schema == nil then
error("Config key not defined: " .. key)