Did you try it?
Works nicely here:
if pcall(function () return type(func) end) then
-- exists
print(type(func))
else
-- undefined
print("undefined")
end
Attention: You need to restart the editor to remove the globals from memory.
Later add as first line / your function stuff:
func = function () end