Update compat.lua

Added Teleport metatable and moved doCreateTeleport to compat.lua.
Merge pull request #971 from curruwilla/patch-4

Update compat.lua