[cmd] Unpack

stable
By Strooth in Miscellaneous Published November 2021 👁 1,204 views 💬 0 comments

Description

Should be part of LUA as standard however due to sandboxing it appears unavailable - usually comes from the C# side but recreated as command in LUA - works just the same, probably just a little bit more overhead. Example usage - local signals = { CC_EasyAdaptiveRSI(1), CC_EasyMVO(2), EasyBBANDS(0), } local signal = GetConsensusSignal(CC_unpack(signals))
HaasScript
-- Author:  Strooth
DefineCommand('unpack', 'local signal = GetConsensusSignal(CC_unpack(signals))')
local unpack 
local list = DefineParameter(ListDynamicType, 'list', 'The list/array/table/Input to unpack', false, {}, 'ListDynamicType, ArrayDataType, TupleDataType, DynamicType, Input')
function unpack(l, i)
      i = i or 1
      if l[i] ~= nil then
        return l[i], unpack(l, i + 1)
      end
end
DefineOutput(DynamicType, IfNull(unpack(list), ''), 'The unpacked flat data i.e. \'result1, result2, result3 ...\'')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!