Using concatenation for key in object?
-
I am trying to name the key for some key value pairs in an object, and I am stuck on concatenation.
local matrixTableReturnObject = { name + "inputNameArray" : inputLabels, name + "outputNameArray" : outputLabels.outputNameArray, name + "outputLabelArray" : outputLabels.labelArray, name + "outputPanelArray" : outputLabels.panelArray, name + "outputLabelPanelArray" : outputLabels.labelPanelArray, name + "outputClickPanelArray" : outputLabels.clickPanelArray, name + "buttonMatrixArray" : buttonMatrix.buttonMatrixArray, name + "inputOutputMatrixArray" : buttonMatrix.inputOutputMatrixArray };
and I am getting this error:
Interface:! GUI_Factory_Methods.js (277): Found '+' when expecting ':'
This is inside an inline function which has an input parameter "name".
How can I get it to concatenate properly to use as a key? -
local matrixTableReturnObject = {}; matrixTableReturnObject[name + "inputNameArray"] = inputLabels; matrixTableReturnObject[name + "outputNameArray"] = outputLabels.outputNameArray; // etc.