http.Get ERROR

Hi guys, I’m having a problem with http.Get, below is the code I’m using.


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

Alright, so the error I’m getting is:


[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

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: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index80e6.html

If anyone knows what my problem is, your help is appreciated :slight_smile:

The http library was changed in GM 13.

Ah, thank you fairy :slight_smile:

No problem.

Use something like this,



local function Success()
   print("Loaded google!")
end
local function Failed()
   print ("Failed to load google!")
end

http.Fetch("www.google.com", Success(), Failed())

Nah.