My solution would be (looking at the logic gates behind it):
function xor(a,b) return (a or b) and (not(a and b)) end