As an aside, the _G is not needed in this case because the frame name is added to the global table as a reference when the frame is created (all frames with names are added to the global table by default)
Lua Code:
local ImmersionFrame = _G.ImmersionFrame
-- is the same as:
local ImmersionFrame = ImmersionFrame
-- is the same as:
local ImmersionFrame = _G["ImmersionFrame")
-- is the same as (in ye olde addon speak):
local ImmersionFrame = getglobal("ImmersionFrame")
Code:
if ImmersionFrame then
if the user doesn't have the Immersion addon, the frame won't exist so what comes after the "if" can be ignored.