What am I doing wrong? everything makes sense.



-- server finder

-- Use this function to perform your initial setup
function setup()
    parameter.text("Server")
    parameter.action("Search",enter)
end

function enter()
    
     http.request(Server,success,fail)
        
        
        function success(status)
            print "Server is on."
        function fail(error)
            print "Could not find server."
            end
            

end
end

What is wrong trying to make request a server and if I does it will say yes I found server
And if it doesn’t it will say server not found.

There is one “end” missing after success function and one too much at the end,
=> the way you wrote it, the fail() is local to success(), so it is not visible to http.request

Thanks and did u know if u copy and paste stuff from github or use a downloader to codea you have to remove all comments that start with – otherwise u get black screen and thanks

Still not working


-- server finder

-- Use this function to perform your initial setup
function setup()
    parameter.text("Server")
    parameter.action("Search",enter)
end

function enter()
    
     http.request(Server,success,fail)
        
       
        function success(status)
            print "server is on."
        end
        function fail(error)
            print "Could not find server."
            end
            

end

Try defining the functions before the call to http.request

How

Oh https=nil

Anyone help me it’s still not working

Still not working

Try this, it works for me.


-- server finder

-- Use this function to perform your initial setup
function setup()
    parameter.text("Server")
    parameter.action("Search",enter)
end

function enter()
    http.request(Server,success,fail)
end

function success(status)
    print ("server is on.",status)
end

function fail(error)
    print("Could not find server.",error)
end

Thanks Dave again I also realized that I didn’t need the status code so the finished version is here



-- server finder

-- Use this function to perform your initial setup
function setup()
    parameter.text("Server","http://")
    parameter.action("Search",enter)
end

function enter()
    http.request(Server,success,fail)
end

function success(status)
    print ("server is on.")
end

function fail(error)
    print("Could not find server.",error)
end

Now how to translate onto screen

Try this.



-- server finder

-- Use this function to perform your initial setup
function setup()
    parameter.text("Server")
    parameter.action("Search",enter)
end

function enter()
    http.request(Server,success,fail)
end

function success(data,status,headers)
    print("server is on.",data,status,headers)
    for a,b in pairs(headers) do
        print(a,b)
    end
end

function fail(error)
    print("Could not find server.",error)
end

I assume Mnjk78lg will not be pleased with the answer. But chances are it was deliberate.

No it’s fine rhe statement my statement above was pondering aloud sorry if I mislead u