Groovy
Retrieve the first object (index [0]) among all objects attached to this page and class XWikiComments
com.xpn.xwiki.api.Object@5eb1ddf9
Retrieve all objects attached to this page and of class XWikiComments
[com.xpn.xwiki.api.Object@6dda2d87, com.xpn.xwiki.api.Object@ee33269, com.xpn.xwiki.api.Object@66029321, com.xpn.xwiki.api.Object@33098fd9, com.xpn.xwiki.api.Object@38c309bc, com.xpn.xwiki.api.Object@cb432c1, com.xpn.xwiki.api.Object@a70236b, com.xpn.xwiki.api.Object@48254b27, com.xpn.xwiki.api.Object@8691272]
Retrieve all objects attached to this page and of class XWikiComments and one of their properties
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor