fixed up types/names for hazard button

This commit is contained in:
Mikayla Fischler 2022-10-07 10:28:46 -04:00
parent 9d60777223
commit d4da6a7f3a
3 changed files with 7 additions and 8 deletions

View File

@ -16,7 +16,7 @@ local config = require("coordinator.config")
local coordinator = require("coordinator.coordinator") local coordinator = require("coordinator.coordinator")
local renderer = require("coordinator.renderer") local renderer = require("coordinator.renderer")
local COORDINATOR_VERSION = "alpha-v0.5.1" local COORDINATOR_VERSION = "alpha-v0.5.2"
local print = util.print local print = util.print
local println = util.println local println = util.println

View File

@ -21,11 +21,10 @@ local element = {}
---@alias graphics_args graphics_args_generic ---@alias graphics_args graphics_args_generic
---|waiting_args ---|waiting_args
---|hazard_button_args
---|multi_button_args ---|multi_button_args
---|push_button_args ---|push_button_args
---|scram_button_args
---|spinbox_args ---|spinbox_args
---|start_button_args
---|switch_button_args ---|switch_button_args
---|core_map_args ---|core_map_args
---|data_indicator_args ---|data_indicator_args

View File

@ -5,7 +5,7 @@ local tcd = require("scada-common.tcallbackdsp")
local core = require("graphics.core") local core = require("graphics.core")
local element = require("graphics.element") local element = require("graphics.element")
---@class scram_button_args ---@class hazard_button_args
---@field text string text to show on button ---@field text string text to show on button
---@field accent color accent color for hazard border ---@field accent color accent color for hazard border
---@field callback function function to call on touch ---@field callback function function to call on touch
@ -15,10 +15,10 @@ local element = require("graphics.element")
---@field y? integer 1 if omitted ---@field y? integer 1 if omitted
---@field fg_bg? cpair foreground/background colors ---@field fg_bg? cpair foreground/background colors
-- new scram button -- new hazard button
---@param args scram_button_args ---@param args hazard_button_args
---@return graphics_element element, element_id id ---@return graphics_element element, element_id id
local function scram_button(args) local function hazard_button(args)
assert(type(args.text) == "string", "graphics.elements.controls.hazard_button: text is a required field") assert(type(args.text) == "string", "graphics.elements.controls.hazard_button: text is a required field")
assert(type(args.accent) == "number", "graphics.elements.controls.hazard_button: accent is a required field") assert(type(args.accent) == "number", "graphics.elements.controls.hazard_button: accent is a required field")
assert(type(args.callback) == "function", "graphics.elements.controls.hazard_button: callback is a required field") assert(type(args.callback) == "function", "graphics.elements.controls.hazard_button: callback is a required field")
@ -77,4 +77,4 @@ local function scram_button(args)
return e.get() return e.get()
end end
return scram_button return hazard_button