What's wrong here?

Every time this is run, it just closes (which is only supposed to happen once the http.request is successful). It’s supposed to close once, then run the app.

function setup()
    if readText("Documents:game")==nil then
        http.request("https://raw.githubusercontent.com/Saturn031000/Codea_Examples/master/Stopwatch.lua", yeap, nup)
    else
        GAME=readText("Documents:game")
        loadstring(GAME)()
        setup()
    end
end

function draw()
    background(0,0,0,255)
end

function yeap(txt)
    saveText("Documents:game", txt)
    close()
end

function nup()
    alert("GAME NOT DOWNLOADED FROM THE INTERNET.", "ERROR")
end

your setup() is making an infinite loop with infinite http requests…

@Jmv38 - How do I fix it?

come on… think about it a little bit and find a solution. It is not that difficult.

Actually i might be wrong about the infinite loop (i looked to fast at your code). Check if your text document is really created. The problem might be there.

@Jmv38 - Did a bit of searching, and found this. Probably the same problem.

EDIT: Got around the problem by using saveLocalData instead of saveText

@Saturn031000, you’ll be glad to know this is fixed in 2.3. Text files are quite useful.

Also, if you are using saveLocalData that is different from saveText, a more equivalent function would be saveProjectData