This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Ziriee's profile picture

Update Check

Started by Ziriee, 02 September 2013 - 10:30 AM
Ziriee #1
Posted 02 September 2013 - 12:30 PM
Anybody knows how to check for updates for a program on pastebin? I would like to keep my program up to date whenever I choose to update the program
tesla1889 #2
Posted 02 September 2013 - 01:00 PM
create a custom header system and put all of the metadata at the top:
--[[
Program Name
version:
release:
patch:
--]]

then, parse the download for the version, release, and patch numbers to check if you need to update
theoriginalbit #3
Posted 02 September 2013 - 01:01 PM
The easiest method would be to download the pastebin contents and compare it to the file itself… So if you open the file read all its contents and then read all the contents from pastebin, they should be the same, if they aren't, then the versions of the file are different.

There are other better ways to check for updates, but all of them either require a 3rd party API or require the use of another website, instead of pastebin… For example I have been known in the past to have a CSV file on my Dropbox that contains program names and their current versions, then using my very old version API where I could quickly check the state of all the files with function calls.

EDIT: You can do what tesla posted, but in the time it would take you to parse the string and then compare, you may as well just compare the 2 files directly. It'd be much quicker.
Edited on 02 September 2013 - 11:02 AM
Ziriee #4
Posted 02 September 2013 - 01:06 PM
Thanks guys.