cTID and sTID

Discussion of the xtools Toolkit

Moderators: Tom, Kukurykus

robpat

cTID and sTID

Post by robpat »

xbytor wrote:Or, to get really concise:

Code: Select allfunction cTID(s) {
  return cTID[s] || cTID[s] = app.charIDToTypeID(s);
};

function sTID(s) {
  return sTID[s] || sTID[s] = app.stringIDToTypeID(s);
};

I wonder why this wouldn't prompt any errors.
|| has a higher precedence than =.

Code: Select allreturn cTID[s] || cTID[s] = app.charIDToTypeID(s);
should do something like
Code: Select allreturn (cTID[s] || cTID[s]) = app.charIDToTypeID(s);
and prompt errors, however, Photoshop does
Code: Select allreturn cTID[s] || (cTID[s] = app.charIDToTypeID(s));.