neccooy Posted November 14, 2011 Share Posted November 14, 2011 Şu şekilde veri alıyorum: [quote] my_table = {}; for x = 1, 4 do miktar = ListIcon.GetCellText("ListBox1", x, 2); Table.Insert(my_table, x, miktar); end [/quote] Depolanan veriler rakam, bunları toplatmak istiyorum. Nasıl yapabilirim? Bu arada ListIcon'da ilk satır "0" olarak geçiyor ama table oluştururken 0. dizi olmuyor, bunu nasıl aşabilirim. İşin aslı, ListIconda o an tüm dolu satırların, artık kaç tane varsa, 3. sütünündaki (listicona göre 2) rakamsal verileri toplatmak istiyorum. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted November 15, 2011 Share Posted November 15, 2011 örnek proje verirsen bakabiliriz. ayrıca listicon indexi ile tablo indexi ni eşleştirmek için dönen sayıyı -1 yaparak kullanabilirsin. ör: [quote]my_table = {}; for x = 1, 4 do miktar = ListIcon.GetCellText("ListBox1", [b]x-1[/b], 2); Table.Insert(my_table, [b]x-1[/b], miktar); end[/quote] Quote Link to comment Share on other sites More sharing options...
neccooy Posted November 15, 2011 Author Share Posted November 15, 2011 Teşekkürler, "x-1" aklıma gelmemişti. Eve gidince denerim. Table'daki verileri nasıl toplatabilirim? Eve gidince örnek projeyi gönderirim, daha anlaşılır olur. Amacıma ulaşmak için belki daha bir pratik yol vardır. Hoşçakal. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted November 15, 2011 Share Posted November 15, 2011 tablonun içindeki rakamları şu şekilde nToplam değişkenine toplatabilirsin: [quote]tablo = {5,10,20,50,100} nToplam = 0; for i,v in pairs(tablo) do nToplam = nToplam+v; end Dialog.Message("toplam", nToplam)[/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.