Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Roku Guru

"ERROR: roArray.Append: parameter is self reference"

BrightScript Debugger> l = [1,2]: l.append(l): ? l
BRIGHTSCRIPT: ERROR: roArray.Append: parameter is self reference
<Component: roArray> =
[
    1
    2
]

Okay, so this is just lazy!  😛
Best would be if it actually worked, like in "normal" languages. If it doesn't though, it should be a proper error and not a warning.
0 Kudos
2 REPLIES 2
RokuKC
Roku Employee
Roku Employee

Re: "ERROR: roArray.Append: parameter is self reference"

"EnTerr" wrote:
BrightScript Debugger> l = [1,2]: l.append(l): ? l
BRIGHTSCRIPT: ERROR: roArray.Append: parameter is self reference



"Doctor, it hurts when I do this!"
"Then don't do that."
😉
0 Kudos
EnTerr
Roku Guru

Re: "ERROR: roArray.Append: parameter is self reference"

In Soviet Russia... the wrongs right you! 😉



sub appendoplasty(l1, l2): 
'if l1 <> l2 then l1.append(l2): return 'alas, case of "the dog in the manger"
 tmp = []
 tmp.append(l2)
 l1.append(tmp)
end sub
0 Kudos