Groovy
Retrieve the first object (index [0]) among all objects attached to this page and class XWikiComments
com.xpn.xwiki.api.Object@6b2e2ad1
Retrieve all objects attached to this page and of class XWikiComments
[com.xpn.xwiki.api.Object@3777c9f4, com.xpn.xwiki.api.Object@196bce9f, com.xpn.xwiki.api.Object@74ca35c2, com.xpn.xwiki.api.Object@78f8f75, com.xpn.xwiki.api.Object@62134e33, com.xpn.xwiki.api.Object@61732892, com.xpn.xwiki.api.Object@4f6cbb39, com.xpn.xwiki.api.Object@6b77c3eb, com.xpn.xwiki.api.Object@3dfb06c]
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