Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to get
Started by owlondrugs Jan 11 2020 04:13 PM

4 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

owlondrugs

[GLOBAL: userInfoPane.html]
owlondrugs
  • Observer

  • 9 posts
  • Corona SDK

display.setDefault( "anchorX", 0 )
display.setDefault( "anchorY", 0 )
-- Your code here
local tilesGroup = display.newGroup()
t ={}
for i=1,6 do
for j=1,6 do
local item = display.newCircle(tilesGroup,32*i-32, 32*j-58, 16)
table.insert( t, item)
end
end
--
tilesGroup.x = display.contentCenterX/2
tilesGroup.y = display.contentCenterY/2
--
local circ = display.newCircle(0, 0, 32)
circ:setFillColor( 0.5 )
circ.name = "circ"
local function tapListener( event )
    local object = event.target
    print( "TAP"..object.x..object.y.."index="..object.index)
end
item:addEventListener( "tap", tapListener )

How do i get or interact with the desired object in the table?



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,641 posts
  • Corona SDK

https://docs.coronalabs.com/api/library/table/indexOf.html



[TOPIC: post.html]
#3

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,960 posts
  • Corona SDK

indexOf is really handy, when was that added? I hope it hasn't always been there :D



[TOPIC: post.html]
#4

Michael Flad

[GLOBAL: userInfoPane.html]
Michael Flad
  • Contributor

  • 268 posts
  • Corona SDK

http://web.archive.org/web/20120628204429/https://docs.coronalabs.com/api/library/table/indexOf.html

 

:)



[TOPIC: post.html]
#5

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,960 posts
  • Corona SDK

Haha, looks like I learnt the API in 2010 and never looked again!


[topic_controls]
[/topic_controls]