var TcHmi;!function(TcHmi){!function(Functions){!function(Beckhoff){Beckhoff.SetElementByIndex=function(ctx,arraySymbol,arrayIndex,value){if(!ctx)throw new TypeError("Parameter 'ctx' must be defined.");if(!ctx.success||!ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are missing.");if("function"!=typeof ctx.success||"function"!=typeof ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are not of type 'function'.");null!==arraySymbol?arraySymbol instanceof TcHmi.Symbol?arraySymbol.readEx((function(rdata){if(rdata.error===TcHmi.Errors.NONE)if(Array.isArray(rdata.value)){const convertedArrayIndex=parseInt(arrayIndex,10);if(isNaN(convertedArrayIndex))return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: SetElementByIndex, Requested array index (${arrayIndex}) is not a number.`,domain:"Function"});if(convertedArrayIndex<0)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: SetElementByIndex, Requested array index (${convertedArrayIndex}) is negative.`,domain:"Function"});if(!(rdata.value.length>convertedArrayIndex))return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: SetElementByIndex,  Array length (${rdata.value.length}) is smaller than requested array index (${convertedArrayIndex})`,domain:"Function"});rdata.value[convertedArrayIndex]=value,arraySymbol.write(rdata.value,(function(wdata){return wdata.error===TcHmi.Errors.NONE?void ctx.success():void ctx.error(wdata.error,{code:wdata.error,message:TcHmi.Errors[wdata.error],reason:"Function: SetElementByIndex, symbol value write failed",domain:"Function",errors:wdata.details?[wdata.details]:void 0})}))}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Function: SetElementByIndex, Invalid type. Expected "arraySymbol" to be an array.',domain:"Function"});else ctx.error(rdata.error,{code:rdata.error,message:TcHmi.Errors[rdata.error],reason:"Function: SetElementByIndex, symbol value read failed",domain:"Function",errors:rdata.details?[rdata.details]:void 0})})):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Function: SetElementByIndex, parameter is no symbol.",domain:"Function"}):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Function: SetElementByIndex, Requested array symbol is not set.",domain:"Function"})}}(Functions.Beckhoff||(Functions.Beckhoff={}))}(TcHmi.Functions||(TcHmi.Functions={}))}(TcHmi||(TcHmi={})),TcHmi.Functions.registerFunctionEx("SetElementByIndex","TcHmi.Functions.Beckhoff",TcHmi.Functions.Beckhoff.SetElementByIndex);