Renoise classes - some clarification

I have a very noobish question about the internal classes of the Renoise LUA API.

I got very excited when I noticed the following is working:

local my_songpos_object = renoise.SongPos()
my_songpos_object.line = 2 = my_songpos_object

So I thought that maybe I could do the same with renoise.PatternLine and even renoise.PatternTrack, but it turns out I can’t. At least not with the same kind of syntax.

renoise.PatternLine() won’t return an object the same way renoise.SongPos() does. And just renoise.PatternLine will reveal “userdata” upon oprint, which I don’t know how to access.

Am I missing some syntax here? Am I wrong to assume that Renoise classes are reusable this way? If not, how to access their constructors?

Indeed - ‘userdata’ classes are C+ implementations wrapped in lua. They can’t be overridden/redefined as such.

This was the motivation to create my own implementations in purelua (e.g. xNoteColumn). I wanted a note-column which could exist outside of the song document.

And doing native lua implementations doesn’t really impact the performance that much. Often, the real bottleneck can be when you have too much communication going on between lua and C.

As for SongPos, this is a special case. As you discovered, it’s not userdata but just a couple of values wrapped in a lightweight lua class.

I’m not sure why it was implemented in this way - guess it could even have been just a simple table, like selection_in_pattern. But the extra operators (equal, larger than) are useful enough to warrant a lua class implementation.

Ok, Thanks! That special case obviously got me confused. So I assume there is no way whatsoever tricking line(index):copy_from(object) into accepting a custom made object. I’ll do it the other way around then - my_line_class:copy_to()