Bug in getFolderContents in 4.1?

Is anyone else having trouble with getFolderContents? I am trying to get a listing of filenames in a directory, but it appears that the files are put in the array without quotes, so when I try to access the individual elements in the array, it thinks they are index objects.

Here’s the code I’m working with (it does work in 3.5.7):

vDirFiles = plugins.file.getFolderContents(dir, new Array(‘jpg’));
var aFiles = databaseManager.createEmptyDataSet(vDirFiles.length,1)
for(var x=1; x <= vDirFiles.length; x++)
{
var vPhotoFile = vDirFiles(x-1).toString()
//aFiles.setValue(x,1) = vDirFiles[x-1]
aFiles.setValue(x,1) = vPhotoFile
}

Is this a bug, or am I doing something wrong?

See/continue here: viewtopic.php?f=22&t=11787#p58990