Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Day6

-- Get all lines from a file, return nil if the file does not exist or retutn the sum of all the lines if it exist
function findclosest(coord,x,y)
    for i=1, ncoord do
        for j=1, ncoord do
            if 
        end
    end
end
 
function lines_from(file)
    coord = {}
    i = 1
    for line in io.lines(file) do 
        coord[i] = {}
        x,y = line:match("(%d+),%s(%d+)")
        coord[x][y] = i 
        i = i + 1
    end
    ncoord = i - 1
 
    for i=1, ncoord do
        for j=1, ncoord do
             if not coord[x][y] then
                 findclosest(coord,x,y)
             end
        end   
    end
 
end

lines_from(stdin)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.