how to Copy and Paste Note Column

I would have thought this would work to copy the contents of the note column under the cursor to the first pattern/track/line/column of the song.

 renoise.song():pattern(1):track(1):line(1).note_columns[1] = renoise.song().selected_note_column  

But although it doesn’t through up an error it doesn’t appear to want to do anything. Is it possible to change contents of entire Objects like this? Preferably I want to do something more like:

(Obviously variable p, t, l and c aren’t defined in the example above but I couldn’t be bothered to write selected/pattern/track/line/column for each.)

But something must be wrong in my thinking…

(YES I do know a similar tool exists and I could try and track it down and use it, or even extract the bits I want. But I want to create the tool myself to extend my understanding and to have the functions which I personally find useful collated together.)

Did you tried something like:

  
local p = renoise.song().selected_pattern_index  
local t = renoise.song().selected_track_index  
local l = renoise.song().selected_line_index  
local n = renoise.song().selected_note_column_index  
renoise.song():pattern(1):track(1):line(1).note_columns[1] = renoise.song().pattern[p].track[t].line[l].note_columns[n]   
  

Clearly the API gives you this option:

– Copy the column’s content from another column.
renoise.song().patterns[].tracks[].lines[].note_columns[]:copy_from(
other_column object)

I haven’t tried this one anywhere myself though.

Yep, same result (nothing seen but no error messages.)

Also tried with:

renoise.song().patterns[1].tracks[1].lines[1].note_columns[1] = renoise.song().patterns[p].tracks[t].lines[l].note_columns[n]  

As this is now the way to access seem to be mentioned more often in the documentation but I was told that generally renoise.song():pattern():track[]… is quicker than renoise.song().patterns[].tracks[]… although I do have to admit I don’t really understand the difference. Also I have found I’ve always had to leave the last segment as the .xxxxs[] version otherwise it always throws up an error (ie with a period, plural word and square parenthesis, rather than colon, singular word and round parenthesis. I think the colon versions are Functions, correct? Iterations??)

I will try with the Copy Contents now. Seems weird that you can’t tell two objects that are both NoteColumn Objects that one equals the other. Although if they’re Tables I remember there are weird things with LUA and tables (you have to do a Table Copy command, telling a variable that it equals a table only creates a variable that points to the already existing table.)

Works fine and I can even use my variable as the other_column_object rather than copy from an existing cell so does everything I need. Still seems a weird way of going about things but OOP I have found a bit like that in general… ;)

Everything are tables in Lua, it is just the part where you can’t always see when you are referring to an address of a table or its true value content. At least some of this stuff has to be copied over to your own tables and then back to the Renoise tables so that Renoise can pick up their values. (Like sequencer.pos)
I sometimes really miss the remarks in the API Docs whether options and values are passed by reference or by value, this is important info imho.