Update compat.lua

Added Teleport metatable and moved doCreateTeleport to compat.lua.