mb_1 Posted May 16, 2015 Share Posted May 16, 2015 Arkadaşlar herkese kolay gelsin. Ben yeni AMS öğreniyorum. Belli bir aşamaya gelmeye çalışıyorum. Fakat kafama bir şey takıldı ve sormak istedim. AMS nin yardım kısmında TAblo kopyalama kısmında şu komut vardı: table_one = { mood="Happy", temperature="Warm" }; -- create a copy table_two = {}; for index, value in pairs(table_one) do table_two[index] = value; end -- modify the copy table_two.temperature = "Cold"; Dialog.Message("Table one temperature is:", table_one.temperature); Dialog.Message("Table two temperature is:", table_two.temperature); burada neden for döngüsünü kullanmış olabilir??? for döngüsünü kullanmadan da yapılıyor... Quote Link to comment Share on other sites More sharing options...
KintaRo Posted May 16, 2015 Share Posted May 16, 2015 bence de gerek yok, table2 = table1; demesi yeterli. Quote Link to comment Share on other sites More sharing options...
dagyutan Posted May 17, 2015 Share Posted May 17, 2015 Acaba burada farklı birşey yok mudur kintaro abi Sent from my iPhone using Tapatalk Quote Link to comment Share on other sites More sharing options...
mb_1 Posted May 17, 2015 Author Share Posted May 17, 2015 Abi burada birinci tablonun temorature değerini farklı ikinci tablonun temprature değerini farklı yazmak için bu kodu kullanmış Senin yazdığın kodla ikisinin temprature değeri aynı oluyo. Ama sorum şu neden for döngüsü???? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 17, 2015 Editor Share Posted May 17, 2015 table2 = table1; kintaronun verdiği örnek aslında temel anlamda işini görür fakat , pointer gibi algılandıgı için. bir tablodaki değişiklik diğerinide etkiliyor. Mecburen döngüye sokup sırası ile ilk tablodaki verileri alıp diğerine aktarmak gerekiyor bu yüzdende for döngüsü kullanılıyor. Quote Link to comment Share on other sites More sharing options...
mb_1 Posted May 17, 2015 Author Share Posted May 17, 2015 (edited) "Pairs" o zaman senin dediğine göre burdaki for döngüsü table_one deki verileri aktarma döngüsü gibi çalışıyor. Yanlış mıyım??? Örneğin ilk başta 1 öğedeki veriyi aktar geri dön ikinci öğedeki veriyi aktar şeklinde... Edited May 17, 2015 by mb_1 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 17, 2015 Editor Share Posted May 17, 2015 Aynen öyle yani bir döngü kullanmak gerekiyorki 1. tablodaki verilerin tamamını gezsin ve diğerine aktarsın. Bu for döngüsü olur while,do while,repeat olabilir farketmez. Kullanım kolaylıgına göre for kullanılmış. Quote Link to comment Share on other sites More sharing options...
mb_1 Posted May 17, 2015 Author Share Posted May 17, 2015 Hepinize teşekkür ederim ayrı ayrı Quote Link to comment Share on other sites More sharing options...
mb_1 Posted May 17, 2015 Author Share Posted May 17, 2015 Ya abiler kusura bakmayın ben bu işi while ile yapamadım. Nasıl yapılır bi yardımcı olun bana yaaa??? Quote Link to comment Share on other sites More sharing options...
KintaRo Posted May 17, 2015 Share Posted May 17, 2015 i = 0; while (tablo1) do i = i+1; table2[i] = table1[i]; end 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.