Autoupdate?

Okay, so i got my client.lua in addons/goz3rr/lua/autorun/client and i got client.lua on a webserver, could anyone provide me with a snippet to update the lua file? (The addon is clientside and only uses 1 lua file)

use the HTTP library to download the file’s text and then use [lua]
function httpCallBack(contents , size)
RunString(contents)
end
http.Get(“http://yoursite.com”, “”, httpCallBack)[/lua]

If you are trying to use this for a hack I wouldn’t suggest this method.

Why would this be for a hack? He’s updating an addon.

Basically what CmdrMatthew said. FapHack has a much more elaborate method which you’re welcome to browse through if you want.

[editline]8th January 2011[/editline]

Why not? Works perfectly for me.

I’ve been told RunString is extremely easy to break. I skimmed over what he said, and I saw client so I just figured.

Well, it is. That’s why you check for returns and load a hard copy if you can’t run the updated copy.

Any function is incredibly easy to break.

thats why you remove the function before it loads the hack, you cant hard copy a c++ function.

I think you misunderstand what I meant. If RunString/CompileString doesn’t do the job correctly, you run an (outdated) version of the script.

[editline]9th January 2011[/editline]

FapHack (basically) does this, and deletes the updated copy so as it will update the next time GMod launches.

So i now got a way of checking for updates and downloading the latest if needed to a .txt file. The updater is in the same file as the hard copy of my script. How would i get it to execute the new copy and replace the old one on asap?