Agenda de Contatos - 01

Gera um arquivo txt com os contatos.
Create a txt file with contacts.

function cadastro(name, phone, zip)
    return {name = name, phone = phone, zip = zip}
end

i = "y"
while i == "y" do
    print("input name")
    a = io.read()
    print("input phone")
    b = io.read()
    print("input zip")
    c = io.read()
    p = ((#list) + 1)
    list[p] = cadastro(a, b, c)
    file = io.open("schedata.txt","a+")
    file:write(list[p].name.." "..list[p].phone.." "..list[p].zip.."\n")
    file:close ()
    print("do you want to add a contact? - (y)es (n)o")
    i = io.read()
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.