• http.Get ERROR
    5 replies, posted
Hi guys, I'm having a problem with http.Get, below is the code I'm using. [CODE]function httpCallBack(contents , size) //local find = string.find(contents,"<br>") PrintMessage(HUD_PRINTTALK, string.gsub( contents, "<br>", " - " ) .. "mins.") end //Chat Commands function Say(usr, text, public) if(string.find(text,"youtube.com"))then http.Get("http://starlight.com/zend/?y="..text, "", httpCallBack) end end[/CODE] Alright, so the error I'm getting is: [CODE][ERROR] gamemodes/suicidesurvival/gamemode/init.lua:65: attempt to call field 'Get' (a nil value) 1. v - gamemodes/suicidesurvival/gamemode/init.lua:65 2. unknown - lua/includes/modules/hook.lua:82[/CODE] By this, I'm assuming http has to be an object, but I've searched and I haven't figured out what kind of object it's suppose to be. I got the example script from this website here: [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index80e6.html[/url] If anyone knows what my problem is, your help is appreciated :)
[url]http://wiki.garrysmod.com/page/Libraries/http/Fetch[/url] The http library was changed in GM 13.
Ah, thank you fairy :)
No problem.
Use something like this, [CODE] local function Success() print("Loaded google!") end local function Failed() print ("Failed to load google!") end http.Fetch("www.google.com", Success(), Failed())[/CODE]
[QUOTE=Minteh Fresh;39340852]Use something like this, [CODE] local function Success() print("Loaded google!") end local function Failed() print ("Failed to load google!") end http.Fetch("www.google.com", Success(), Failed())[/CODE][/QUOTE] Nah.
Sorry, you need to Log In to post a reply to this thread.