Contents

Object Access

You can access objects in an object layer in one of several ways.



layer.object Table

An object layer stores each of the layer's objects in the layer.object table. Just as in the map.layer table, you can access an object through either the object's name (set from Tiled) or the object's index.

local object

object = map.layer[x].object[1] -- The first object in the layer

object = map.layer[x].object["object"] -- The object named "object" in Tiled


Iterators

Object layers also provide a number of ways to iterate through each object in the layer. See the object iterator reference for more information.