From d4da6a7f3a53f497fbbb0daa4f7c26734732a0d2 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 7 Oct 2022 10:28:46 -0400 Subject: [PATCH] fixed up types/names for hazard button --- coordinator/startup.lua | 2 +- graphics/element.lua | 3 +-- graphics/elements/controls/hazard_button.lua | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 708c3d3..2fbe51d 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -16,7 +16,7 @@ local config = require("coordinator.config") local coordinator = require("coordinator.coordinator") local renderer = require("coordinator.renderer") -local COORDINATOR_VERSION = "alpha-v0.5.1" +local COORDINATOR_VERSION = "alpha-v0.5.2" local print = util.print local println = util.println diff --git a/graphics/element.lua b/graphics/element.lua index 2e4c906..907cc8e 100644 --- a/graphics/element.lua +++ b/graphics/element.lua @@ -21,11 +21,10 @@ local element = {} ---@alias graphics_args graphics_args_generic ---|waiting_args +---|hazard_button_args ---|multi_button_args ---|push_button_args ----|scram_button_args ---|spinbox_args ----|start_button_args ---|switch_button_args ---|core_map_args ---|data_indicator_args diff --git a/graphics/elements/controls/hazard_button.lua b/graphics/elements/controls/hazard_button.lua index 90a2118..c931f19 100644 --- a/graphics/elements/controls/hazard_button.lua +++ b/graphics/elements/controls/hazard_button.lua @@ -5,7 +5,7 @@ local tcd = require("scada-common.tcallbackdsp") local core = require("graphics.core") local element = require("graphics.element") ----@class scram_button_args +---@class hazard_button_args ---@field text string text to show on button ---@field accent color accent color for hazard border ---@field callback function function to call on touch @@ -15,10 +15,10 @@ local element = require("graphics.element") ---@field y? integer 1 if omitted ---@field fg_bg? cpair foreground/background colors --- new scram button ----@param args scram_button_args +-- new hazard button +---@param args hazard_button_args ---@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.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") @@ -77,4 +77,4 @@ local function scram_button(args) return e.get() end -return scram_button +return hazard_button