1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 03:40:14 +00:00

Check if options arguments are a table

This commit is contained in:
uramer 2022-04-29 18:56:37 +02:00
parent 9b27973479
commit 26154c85a1
2 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,9 @@ local groupSection = contextSection(groupSectionKey)
groupSection:removeOnExit() groupSection:removeOnExit()
local function validateSettingOptions(options) local function validateSettingOptions(options)
if type(options) ~= 'table' then
error('Setting options must be a table')
end
if type(options.key) ~= 'string' then if type(options.key) ~= 'string' then
error('Setting must have a key') error('Setting must have a key')
end end
@ -24,6 +27,9 @@ local function validateSettingOptions(options)
end end
local function validateGroupOptions(options) local function validateGroupOptions(options)
if type(options) ~= 'table' then
error('Group options must be a table')
end
if type(options.key) ~= 'string' then if type(options.key) ~= 'string' then
error('Group must have a key') error('Group must have a key')
end end

View File

@ -249,6 +249,9 @@ storage.playerSection(common.groupSectionKey):subscribe(async:callback(function(
end)) end))
local function registerPage(options) local function registerPage(options)
if type(options) ~= 'table' then
error('Page options must be a table')
end
if type(options.key) ~= 'string' then if type(options.key) ~= 'string' then
error('Page must have a key') error('Page must have a key')
end end