Wednesday, May 16, 2012

table.insert(), table.remove()

    local a = {"Ariel", "Barbie", "Clara"}   
     
    table.insert(a, 3, "Zelda")   
    print("-----------------")   
       for k, v in pairs(a) do   
       print(k, v)   
    end   
       
    table.remove(a, 2)   
    print("-----------------")   
    for k, v in pairs(a) do   
       print(k, v)   
    end   
     
    table.remove(a, 1)   
    print("-----------------")   
    for k, v in pairs(a) do   
       print(k, v)   
    end   

No comments:

Post a Comment