Update misc.lua

If the _G metatable is protected then that code will error, so I've put a check to see if it is and stops the code from running.
Update misc.lua
Merge pull request #228 from iSnipeu/patch-1

Update misc.lua (Thanks, iSnipeu)