Pattern Count

Hi,

is there any command to get number of the last created Pattern? Or to count all Patterns in a Song?

local number_of_patterns = #renoise.song().patterns

thanks