Concatenate trouble

Hi,

i have a question regarding concatenating things, how can i make something like this work?
[lua]for i=1, 3 do
if t[i].part… i… .color) == “blue” then
table.insert(parts2Group, t[i].part… i)
end
end[/lua]

any help is appreciated [import]uid: 16142 topic_id: 18198 reply_id: 318198[/import]

Take a read through the API and example usage, I think it will help you; http://developer.anscamobile.com/reference/index/tableconcat-table-sep-i-j

Peach :slight_smile:

[import]uid: 52491 topic_id: 18198 reply_id: 69646[/import]

i dont think this is what i need
i can do this:
[lua]local t = {“blue”, “color”}

print(table.concat(t, “.”, 1,2))[/lua]

but cant do what i need, this:
[lua]local t = {color = “blue”, anothercolor = “yellow”}

print(table.concat(t, “.”, 1,2))
[lua] [import]uid: 16142 topic_id: 18198 reply_id: 69697[/import]

Your first example will return the exact same as printing just this;
[lua]print(table.concat(t, “.”))[/lua]

I’m not totally sure what you are trying to achieve or if you actually want to concatenate at all.

Can you tell me what your goal is?

Peach :slight_smile: [import]uid: 52491 topic_id: 18198 reply_id: 69760[/import]

i have images for part1, part2,part3 in a table and each of this parts have a .color attached to them
and i want to check what parts come with “green” color and put them to separate table
and i want it without copy\paste code) [import]uid: 16142 topic_id: 18198 reply_id: 69766[/import]

So could you not just setup a table for each of these images then run through them and compare them to other tables, then insert accordingly?

Premium support can provide a working demo if necessary; http://www.anscamobile.com/corona/support/

Although if not interested in that I’d encourage you to have a read of this - it’s great for learning a little more about tables; http://blog.anscamobile.com/2011/06/understanding-lua-tables-in-corona-sdk/

Peach :slight_smile: [import]uid: 52491 topic_id: 18198 reply_id: 69849[/import]

I decide that i can live without all this concatenate troubles and will do things other way)
anyway, thanks for support Peach) [import]uid: 16142 topic_id: 18198 reply_id: 69867[/import]

You can make that work. Post up your table so i can see how your setting it up [import]uid: 84637 topic_id: 18198 reply_id: 73230[/import]