}
Vector<SpriteAnimationDirection> directions = new Vector<SpriteAnimationDirection>();
// Traverse the directions table.
LuaValue key = LuaValue.NIL;
while (true) {
Varargs keyValue = directionsTable.next(key);
key = keyValue.arg1();
if (key.isnil()) {
break;
}
LuaValue directionTable = keyValue.arg(2);
int x = directionTable.get("x").checkint();
int y = directionTable.get("y").checkint();
int frameWidth = directionTable.get("frame_width").checkint();
int frameHeight = directionTable.get("frame_height").checkint();
int originX = directionTable.get("origin_x").optint(0);
int originY = directionTable.get("origin_y").optint(0);
int numFrames = directionTable.get("num_frames").optint(1);
int numColumns = directionTable.get("num_columns").optint(numFrames);
Rectangle firstFrameRectangle = new Rectangle(x, y, frameWidth, frameHeight);
try {
SpriteAnimationDirection direction = new SpriteAnimationDirection(