count - Get number of objects by name Corona SDK -
i'm trying see if it's possible objects same name. i'm using following code load bunch of circles on screen. have same
local mycircle = display.newcircle(30+(ycount*20), 220+(ycount*10), 8) mycircle.name = "peg" i imagine there way i'm not sure such thing.
thanks
first of need circle array
array = {} then when create single circle, should add circle array
array[#array+1] = mycircle now here find function spesific name
local function findbyname( name ) local resultarray = {} i=1, #array if array[i].name == name resultarray[#resultarray+1] = array[i] end end return resultarray end so, @ end, when call
local temparray = findbyname( "peg" ) you'll circles named "peg" in temparray
Comments
Post a Comment