#344 graphics assertion overhaul
This commit is contained in:
@@ -25,14 +25,12 @@ local KEY_CLICK = core.events.KEY_CLICK
|
||||
---@param args radio_button_args
|
||||
---@return graphics_element element, element_id id
|
||||
local function radio_button(args)
|
||||
assert(type(args.options) == "table", "controls.radio_button: options is a required field")
|
||||
assert(#args.options > 0, "controls.radio_button: at least one option is required")
|
||||
assert(type(args.radio_colors) == "table", "controls.radio_button: radio_colors is a required field")
|
||||
assert(type(args.select_color) == "number", "controls.radio_button: select_color is a required field")
|
||||
assert(type(args.default) == "nil" or (type(args.default) == "number" and args.default > 0),
|
||||
"controls.radio_button: default must be nil or a number > 0")
|
||||
assert(type(args.min_width) == "nil" or (type(args.min_width) == "number" and args.min_width > 0),
|
||||
"controls.radio_button: min_width must be nil or a number > 0")
|
||||
element.assert(type(args.options) == "table", "options is a required field")
|
||||
element.assert(#args.options > 0, "at least one option is required")
|
||||
element.assert(type(args.radio_colors) == "table", "radio_colors is a required field")
|
||||
element.assert(type(args.select_color) == "number", "select_color is a required field")
|
||||
element.assert(type(args.default) == "nil" or (type(args.default) == "number" and args.default > 0), "default must be nil or a number > 0")
|
||||
element.assert(type(args.min_width) == "nil" or (type(args.min_width) == "number" and args.min_width > 0), "min_width must be nil or a number > 0")
|
||||
|
||||
-- determine widths
|
||||
local max_width = 1
|
||||
|
||||
Reference in New Issue
Block a user