arrsize.js 496 B

123456789101112131415
  1. setup.qsp_arrsize = (arrname) => {
  2. let varnameOfIntegers = arrname;
  3. if(arrname.startsWith('$'))
  4. varnameOfIntegers = varnameOfIntegers.substring(1);
  5. const varnameOfStrings = "$"+varnameOfIntegers;
  6. let result = 0;
  7. for(const lookupArrname of [varnameOfIntegers,varnameOfStrings]){
  8. const sourceVarname = setup.varname(lookupArrname);
  9. const sourceValue = State.getVar(sourceVarname) ?? [];
  10. result += sourceValue.length;
  11. }
  12. return result;
  13. }