Skip to content

GetProgPhaser

Anthony Headley edited this page Jan 23, 2021 · 1 revision

Single Dimmer with 50% in programmer (red text or red background) No selection = bang

-- Not good example of table parser
local function table2String(input, level)
    if type(input) == "boolean" then
        if input == true then
           return "true"
        else
            return "false"
        end
    elseif type(input) == "table" then
        for k, v in pairs(input) do
            v = table2String(v,level + 1)
            local tab = ""
            if level > 0 then
                tab="  "
            end
            Echo(string.format("%s[%s] %s", tab, k, v))
        end
    else
        return tostring(input)
    end
end


-- ****************************************************************
-- plugin main entry point
-- ****************************************************************
local function Main(display_handle,argument)
    local attribute = 0 --dimmer
    local index = SelectionFirst()
    local c = GetUIChannelIndex(index, attribute);
    local p = GetProgPhaser(c, false)
    table2String(p,0)
end
return Main

Returns:
  [mask_integrated] 0
  [absolute] 50.0
  [mask_individual] 2
  [function] 0
[1] nil -- this belongs above [mask_integrated] (lazy programming)
[mask_active_value] 0
[mask_individual] 0
[ui_channel_index] 14
[mask_active_parser]
Clone this wiki locally