Groovy
Retrieve the first object (index [0]) among all objects attached to this page and class XWikiComments
com.xpn.xwiki.api.Object@3ab415c9
Retrieve all objects attached to this page and of class XWikiComments
[com.xpn.xwiki.api.Object@58683254, com.xpn.xwiki.api.Object@20c05624, com.xpn.xwiki.api.Object@33576648, com.xpn.xwiki.api.Object@2efc1b4d, com.xpn.xwiki.api.Object@29647454, com.xpn.xwiki.api.Object@2114c07, com.xpn.xwiki.api.Object@3d9660a0, com.xpn.xwiki.api.Object@5ba1c7f6, com.xpn.xwiki.api.Object@5a4f1679]
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