A non-specific way to figure it out was already there - by looking up the exact lines, the meaning of the error was clear. However, this doesn't tell you what the error to search for in your script is, especially if you use fg() and bg() a lot in conjunction with links, normal echos, and such.
I'm wondering, would if color_table[colorName] then <code> else error() end be more efficient, as the concat wouldn't need to happen unless the if failed? Something like this:
function fg(colorName)
if color_table[colorName] then
setFgColor(color_table[colorName][1], color_table[colorName][2], color_table[colorName][3])
else
error("fg: ".. colorName.." is not a valid color!")
end
end
From my tests, seems that this ought to be the same speed as an assert with no concatenation, or possibly even a bit faster (hard to tell).
edit - While I can see that yes, this should prove faster, as no concatenation is happening unless the 'else' hits, in practice I am unable to see any difference between the two methods.
At 20 seconds of code-crunching both ways (stripping out the setFgColor bit, just the if vs assert), I'm unable to see any difference. Both get around 22,500 iterations of code on the loop, before my 20 seconds of crunch expires. I'm not seeing how a concatenation makes any practical difference in speed on my laptop, though I know theoretically it should make some minor bit.