I was looking for a way to, when the lua addon runs, checks if the user is on the most up-to-date version of the addon and if not, it either sends them a notification through chat/console or automatically updates itself.
Thanks in advance- Mexican
Push a GET request to a page containing the current version: [url]https://wiki.garrysmod.com/page/http/Fetch[/url]
You cannot automatically update it
[QUOTE=code_gs;49264974]Push a GET request to a page containing the current version: [url]https://wiki.garrysmod.com/page/http/Fetch[/url]
You cannot automatically update it[/QUOTE]
I haven't touched gLua in a long time, but couldn't you use http.Fetch to get the new code from the host, edit the addon files, and rerun the addon? (assuming it's not a workshop file)
@code_gs Thanks, that really helped & do you think that gist would do the job for the version "holder"?
[editline]7th December 2015[/editline]
[QUOTE=HumbleTH;49265062]I haven't touched gLua in a long time, but couldn't you use http.Fetch to get the new code from the host, edit the addon files, and rerun the addon? (assuming it's not a workshop file)[/QUOTE]
He is saying that I could use the http.Fetch to check a certain file for the version number and compare it to the one the user is running and if they don't match then it sends them a message in console/chat
[editline]7th December 2015[/editline]
[QUOTE=code_gs;49264974]Push a GET request to a page containing the current version: [url]https://wiki.garrysmod.com/page/http/Fetch[/url]
You cannot automatically update it[/QUOTE]
So if I were to use Gist, the code would look something like this:
http.Fetch( [url]https://gist.githubusercontent.com/TeamAlphaex/a3c94fc4c38b52ddcb81/raw/AASVersion[/url], function( body )
if body == 0.0.4 then
Msg( "You're Up-to-date" )
end,
function onFailure( error )
)
I'm not sure why you need this anymore, unless your addon is too big to fit on Workshop. If it's to keep servers updated, they can just subscribe on workshop and let the game update it on its own. If it's to keep clients updated, they can just subscribe on workshop and let the game update it on its own.
[QUOTE=Rocket;49265182]I don't think you can write to any files outside of the data folder.[/QUOTE]
Oh, right, I forgot about that.
i mean you COULD write your whole addon in the data folder as .txt files and run the txt files as lua but that's a horrendous way to go about writing an addon
[QUOTE=bitches;49265254]I'm not sure why you need this anymore, unless your addon is too big to fit on Workshop. If it's to keep servers updated, they can just subscribe on workshop and let the game update it on its own. If it's to keep clients updated, they can just subscribe on workshop and let the game update it on its own.[/QUOTE]
I'm not ready to release on workshop, but I'm allowing certain people to beta test. So this is easier to tell them automatically rather than through steam.
you can host your webpage with the version number on a free service such as google drive
[editline]7th December 2015[/editline]
it seems you're already using github so nevermind lol
[QUOTE=bitches;49265792]you can host your webpage with the version number on a free service such as google drive
[editline]7th December 2015[/editline]
it seems you're already using github so nevermind lol[/QUOTE]
Yes, more specifically Gist
Sorry, you need to Log In to post a reply to this thread.