Thursday, May 3, 2012

function 사용 예

 function sum(a)  
      local sum = 0  
      for i, v in pairs(a) do  
           sum = sum + v  
      end  
      return sum  
 end  
   
 local a = {10, 20, 30, 40}  
 print(sum(a))  
키워드 : 함수

No comments:

Post a Comment