Extensions Swap Object Order

void object.swapOrder ( table object2 )

Exchanges the Z ordering of two objects.  If object was above object2, it will be below it after the call, and vice-versa.

Parameters

object2 The object table of another object to swap order with

Return Values

None.

Example

-- Assume we have a table of objects indexed by ID
object1 = mmf.objects[1]
object2 = mmf.objects[2]
 
-- We assert in the two blocks below that no matter
-- which object was before the other, their order is
-- reversed after the call to swapOrder
if (object1.isAbove(object2)) then
  object1.swapOrder(object2)
  assert(object1.isBelow(object2))
else
  object1.swapOrder(object2)
  assert(object1.isAbove(object2))
end

Copyright 2010 Justin Aquadro