[strvinmarvin] (Snippet) Log Colors and Key,Pair Loop Example

stable
By Strvinmarvin in Miscellaneous Published December 2021 👁 1,124 views 💬 0 comments

Description

This is an example of how to use the loop method 'for key in pairs' on a Lua Array, as well as how to construct an Array manually and how to use the resulting values to change the color of Log text: This can be applied to many kinds of Haasscript objects, such as GetAllOpenPositions(), OrderContainer(), etc.
HaasScript
col = {
    title = Color(194,165,207),
    details = Color(247,247,247),
    
    regresult = Color(255,255,191),
    goodresult = Color(217,240,211),
    
    loss = Color(214,96,77),
    profit = Color(90,174,97),
    
    block = Color(186,186,186),
    
    inform = Color(171,217,233)
}

for key, color in pairs(col) do
    Log(key, color)
end

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!