I have some code where I need to pass a matrix with one value to highlight one row in a table box:
nw = new window("test",
tb = table box(
string col box("Col1", {"aa", "bb", "cc"}),
number col box("Col2", [1, 2, 3])
)
);
rm = [2];
tb << set selected rows(rm);
The row number to be highlighted is a variable. I would like to use the simplest syntax to create the row number matrix using this variable. These methods don't work:
a = 2; // Need a matrix holding this variable value
b = [a]; // Doesn't work
c = [expr(a)]; // No
d = [eval(a)]; // No
e = [eval(expr(a))]; // No
These are the methods I came up with that do work:
// Works but so complicated...
f = eval(parse(evalinsert("[^a^]"))); // Yes
// Works too
g = [1];
g[1] = a; // Yes
Is there a simpler one-liner that I'm missing? I just want to create a matrix like [2] dynamically.