Doflamingo treated Law and Luffy the same way, the very fact that Doflamingo had to be worried about dropping his guard around Law meant he proceeded with Caution when he fought him, not to mention Law had already taken a beating from Fujitora and Doflamingo together before he even fought Doflamingo. In the state he was in he shouldn't have even been fighting let alone hurting Doflamingo.Hard to tell, because we have yet to see Zoro go all out.
But saying that Law hitting Doflamingo is proof he is better than Zoro is nonsense, he only got the hit because Doflamingo was distracted and dropped his guard. On top of that, Doflamingo never once took Law seriously as a opponent, he treated him as if he was a child and smacked him around most of the arc.
Luffy on the other hand didn't manage to injure Doflamingo even once alone in G2 or G3 prior to Doflamingo taking Gamma Knife. Pre G4 Luffy was inferior to a battered up Law.