CoronaBitmap syntax error in filename change


I’m trying to rename my files bitmaps through a script.

I got it for the BitmapTexture class but the same code for the CoronaBitmap class gives an error.

the objective is to change the name of the bitmap to the name of the folder removing the slashes “” and leaving the same extension

tBitmaps = getClassInstances CoronaBitmap

for t in tBitmaps do
(if (isProperty t #filename) then
if (getFilenamePath t.filename) != “” then
(t.filename = (getFilenamePath t.filename) + substituteString (getFilenamePath t.filename) “\” “” + (getFilenameType t.filename)))

the error that appears is: 110 CustomScripts-- Unable to convert: undefined to type: FileName

can anyone help me on this issue? because it works for bitmaptexture, just not for coronabitmap


it is likely that one of the corona bitmaps has no filename provided
it should be enough to check that filename isn’t equal to undefined and perhaps check that file actually exists with doesFileExist



It worked, now I just have to research how to erase empty bitmaps.

If you have this information

The code that worked:

cBitmaps = getClassInstances CoronaBitmap

for c in cBitmaps where not (c.filename == undefined) do
(if (getFilenamePath c.filename) != “” then
(c.filename = (getFilenamePath c.filename) + substituteString (getFilenamePath c.filename) “\” “” + (getFilenameType c.filename)))

tBitmaps = getClassInstances BitmapTexture

for t in tBitmaps where not (t.filename == undefined) do
(if (getFilenamePath t.filename) != “” then
(t.filename = (getFilenamePath t.filename) + substituteString (getFilenamePath t.filename) “\” “” + (getFilenameType t.filename)))


what do you mean by erase? remove from the disc?
btw, look if that’s what you need


I’m Brazilian, sometimes my English goes wrong. Erase I meant remove.