I'm pretty sure you can do something along the lines of:
Code:
if frameName then
-- Code to be executed if it exists
end
If I'm not mistaken
If that does nothing you could just to the nil check
Code:
if (frameName~=nil) then
-- Code to be executed if it exists
end