cTID and sTID

Discussion of the xtools Toolkit

Moderators:xbytor, DavideBarranca, Paul MR

robpat
cTID and sTID

Post by robpat » Wed Jul 27, 2011 7:49 pm

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));.

Post Reply