Getting a tracks type

When I enter this in the interpreter lua obediently tells me the tracks type and returns a number:

oprint(renoise.song().tracks[1].type)  

When doing the same from my tool lua throws an error:

*** main.lua:54: unknown property or function 'type' for an object of type 'PatternTrack'  
*** stack traceback:  
*** [C]: in function '_error'  
*** [string "do..."]:47: in function   
main.lua:54: in function <41><br>```

<br>
What's going on here?</41>

[quote=“tris”]
When I enter this in the interpreter lua obediently tells me the tracks type and returns a number:

oprint(renoise.song().tracks[1].type)  

When doing the same from my tool lua throws an error:

*** main.lua:54: unknown property or function 'type' for an object of type 'PatternTrack'  
*** stack traceback:  
*** [C]: in function '_error'  
*** [string "do..."]:47: in function   
main.lua:54: in function <41><br>```

<br>
What's going on here?<br>[/quote]<br>
<br>
<br>
<br>
Works fine for me, this code prints the types of all your tracks:<br>
<br>

```<br><br>
<br>
for n = 1, #renoise.song().tracks do <br>
  print (renoise.song().tracks[n].type)<br>
end<br>
<br>```

<br>
<br>
<br>
Maybe it's something else in your code?</41>

yep. it is just realised i’m looking at a PatternTrack and not a track.

Cheers!