Track table items usage

Hello guys,

I have one table.

local color = { {key=“red”}, {key=“blue”}, {key=“green”}, {key=“white”} }

How to choose TWO random items from color table, but not the same one (like not to choose two red items)?

Thanks :slight_smile:
Ivan

One way you can achieve this would be to set your chooser up to be the first and second in the table. Then shuffle the table as often as you need to in order to change what the first 2 colors are.

From what I can tell:

  1. create objects

  2. setup a table of colors

  3. function to shuffle the table

  4. function to change the objects color based on the table.

Hope this is helpful,

Here’s a tutorial on this:  https://coronalabs.com/blog/2014/09/30/tutorial-how-to-shuffle-table-items/

Rob

Great guys!

Thanks!

Ivan

One way you can achieve this would be to set your chooser up to be the first and second in the table. Then shuffle the table as often as you need to in order to change what the first 2 colors are.

From what I can tell:

  1. create objects

  2. setup a table of colors

  3. function to shuffle the table

  4. function to change the objects color based on the table.

Hope this is helpful,

Here’s a tutorial on this:  https://coronalabs.com/blog/2014/09/30/tutorial-how-to-shuffle-table-items/

Rob

Great guys!

Thanks!

Ivan