Tuesday, May 1, 2012

complex data structure 만들기 예

 polyline = {color="blue", thickness=2, npoints=4,   
                                     {x=10, y=0},   
                                     {x=20, y=1},   
                                     {x=-30, y=2},   
                                     {x=-40, y=3}   
                  }   
                    
 print(polyline[2].x) --> 20  
 print(polyline[4].y) --> 3  
 print(polyline.color) --> blue  
키워드 : Constructor

No comments:

Post a Comment