Thanks for the quick reply. The reason I’m trying to do this is because I have this function that generates a certain amount of shapes for a physics body, and there’s no predicting how many shapes it will have, I’ve got the following:
[lua]shapes = defineShapes()
physics.addBody(drawingLine,
shapes[1], shapes[2], shapes[3], shapes[4], shapes[5], shapes[6], shapes[7], shapes[8], shapes[9], shapes[10], shapes[11], shapes[12], shapes[13], shapes[14], shapes[15], shapes[16], shapes[17], shapes[18], shapes[19], shapes[20], shapes[21], shapes[22], shapes[23], shapes[24], shapes[25], shapes[26], shapes[27], shapes[28], shapes[29], shapes[30], shapes[31], shapes[32], shapes[33], shapes[34], shapes[35], shapes[36], shapes[37], shapes[38], shapes[39], shapes[40], shapes[41], shapes[42], shapes[43], shapes[44], shapes[45], shapes[46], shapes[47], shapes[48], shapes[49], shapes[50], shapes[51], shapes[52], shapes[53], shapes[54], shapes[55], shapes[56], shapes[57], shapes[58], shapes[59], shapes[60], shapes[61], shapes[62], shapes[63], shapes[64], shapes[65], shapes[66], shapes[67], shapes[68], shapes[69], shapes[70], shapes[71], shapes[72], shapes[73], shapes[74], shapes[75], shapes[76], shapes[77], shapes[78], shapes[79], shapes[80], shapes[81], shapes[82], shapes[83], shapes[84], shapes[85], shapes[86], shapes[87], shapes[88], shapes[89], shapes[90], shapes[91], shapes[92], shapes[93], shapes[94], shapes[95], shapes[96], shapes[97], shapes[98], shapes[99], shapes[100], shapes[101], shapes[102], shapes[103], shapes[104], shapes[105], shapes[106], shapes[107], shapes[108], shapes[109], shapes[110], shapes[111], shapes[112], shapes[113], shapes[114], shapes[115], shapes[116], shapes[117], shapes[118], shapes[119], shapes[120], shapes[121], shapes[122], shapes[123], shapes[124], shapes[125], shapes[126], shapes[127], shapes[128], shapes[129], shapes[130], shapes[131], shapes[132], shapes[133], shapes[134], shapes[135], shapes[136], shapes[137], shapes[138], shapes[139], shapes[140], shapes[141], shapes[142], shapes[143], shapes[144], shapes[145], shapes[146], shapes[147], shapes[148], shapes[149], shapes[150], shapes[151], shapes[152], shapes[153], shapes[154], shapes[155], shapes[156], shapes[157], shapes[158], shapes[159], shapes[160], shapes[161], shapes[162], shapes[163], shapes[164], shapes[165], shapes[166], shapes[167], shapes[168], shapes[169], shapes[170], shapes[171], shapes[172], shapes[173], shapes[174], shapes[175], shapes[176], shapes[177], shapes[178], shapes[179], shapes[180], shapes[181], shapes[182], shapes[183], shapes[184], shapes[185], shapes[186], shapes[187], shapes[188], shapes[189], shapes[190], shapes[191], shapes[192], shapes[193], shapes[194], shapes[195], shapes[196], shapes[197], shapes[198], shapes[199], shapes[200]
)
function defineShapes()
local shapes = nil
shapes = {}
local num = math.floor(drawingLine.numChildren)
print(num)
for i=1, num do
lw = lineWidth/2
sh=nil
sh = {-lw+drawingLine[i].x, -lw+drawingLine[i].y,
-lw+drawingLine[i].x, lw+drawingLine[i].y,
lw+drawingLine[i].x, lw+drawingLine[i].y,
lw+drawingLine[i].x, -lw+drawingLine[i].y}
shapes[i] = {shape=sh, filter={groupIndex=1}}
end
return shapes
end [/lua]
This is just horrible, and there’s no predicting how many shapes there will be, this example works if there are 200 shapes, but there can be 3, 9, 186, 290, anything. And so I wanted to be able to generate the params as a string, and define there how many calls will it have [import]uid: 53195 topic_id: 31911 reply_id: 127283[/import]