"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! :face_with_tongue:
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.

“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.”
:wink:

In Soviet Russia… the wrongs right you! :wink:

[upload|rh1JwB+PhWBiEeyJIazKaQ==]

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