This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// agent is an instance of WebhookClient | |
function setContextData(agent) { | |
const handler = { | |
set(target, property, value) { | |
const parameters = agent.context.get("data") | |
? agent.context.get("data").parameters | |
: {}; | |
parameters[property] = value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Util:hex2rgb(hex) | |
hex = hex:gsub("#","") | |
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- table.indexOf( array, object ) returns the index | |
-- of object in array. Returns 'nil' if not in array. | |
table.indexOf = function( t, object ) | |
local result | |
if "table" == type( t ) then | |
for i=1,#t do | |
if object == t[i] then | |
result = i | |
break |