• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to clone a data structure object (ExtendScript)?

Mentor ,
Sep 24, 2013 Sep 24, 2013

Copy link to clipboard

Copied

Hi,

Is there some quick way to clone a data structure, like a text range, rather than doing all this:

newTR = new TextRange();

newTR.beg.obj = oldTR.beg.obj;

newTR.beg.offset = oldTR.beg.offset;

newTR.end.obj = oldTR.end.obj;

newTR.end.offset = oldTR.end.offset;

I tried this, but it failed as I expected:

newTR = oldTR.clone();

I tried this, but I got back the same object:

newTR = new TextRange(oldTR.beg, oldTR.end);

Any ideas?

Thanks,

Russ

TOPICS
Scripting

Views

729

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 10, 2013 Oct 10, 2013

Copy link to clipboard

Copied

LATEST

Hi Russ,

A little late in responding, and not much to help you forward, I'm afraid. The TextRange object seems to merely contain pointers to its objects, rather than copies of the objects themselves. I have run into problems even setting the offset of the beg and end objects separately without first creating two new objects for them explicitly. Strange animals, those TextRanges.

Ciao

Jang

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines