1
0

copyarr.js 741 B

12345678910111213141516171819
  1. setup.qsp_copyarr = (target,source,start=0,length=undefined) => {
  2. const sourceVarname = setup.varname(source);
  3. const sourceVarname_Dict = sourceVarname + "_indexDict";
  4. const targetVarname = setup.varname(target);
  5. const targetVarname_Dict = targetVarname + "_indexDict";
  6. const sourceValue = State.getVar(sourceVarname) ?? [];
  7. const sourceValue_Dict = State.getVar(sourceVarname_Dict);
  8. length ??= sourceValue.length;
  9. const slicedSourceValue = sourceValue.slice(start,start + length);
  10. State.setVar(targetVarname, slicedSourceValue);
  11. if(sourceValue_Dict){
  12. const slicedDictValue = sourceValue_Dict.slice(start,start + length);
  13. State.setVar(targetVarname_Dict, slicedDictValue);
  14. }
  15. }