mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
feat: add a version checker and bump to 1.0.1
Since this is being developed alongside other projects, adding a version checker is going to save some time.
This commit is contained in:
12
README.md
12
README.md
@@ -4,11 +4,17 @@ The idea of this resource is to create a set of reusable functions for importing
|
|||||||
Everyone is free to utilise either the library or code from it so long as [the license is respected and adhered to](https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)).
|
Everyone is free to utilise either the library or code from it so long as [the license is respected and adhered to](https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)).
|
||||||
|
|
||||||
- [x] Server Callbacks
|
- [x] Server Callbacks
|
||||||
- [ ] Table utilities
|
- [x] Table utilities
|
||||||
- [x] OxMySQL library
|
- [x] OxMySQL library
|
||||||
- [ ] Native wrappers (animations, spawning, etc.)
|
- [ ] Native wrappers (animations, spawning, onesync, etc.)
|
||||||
- [ ] Iterators
|
- [ ] Iterators
|
||||||
- todo: think of more stuff
|
- [ ] Exports (for non-runtime critical functions)
|
||||||
|
|
||||||
|
##### To do
|
||||||
|
- Think of more features
|
||||||
|
- Improvements to import function?
|
||||||
|
- Improve table utilities (matches doesn't work properly for hash tables)
|
||||||
|
- Transfer non-essential code from ox inventory
|
||||||
|
|
||||||
### How to utilise ServerCallbacks
|
### How to utilise ServerCallbacks
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ lua54 'yes'
|
|||||||
game 'gta5'
|
game 'gta5'
|
||||||
|
|
||||||
--[[ Resource Information ]]--
|
--[[ Resource Information ]]--
|
||||||
name 'lua library'
|
name 'pe-lualib'
|
||||||
author 'Linden'
|
author 'Linden'
|
||||||
version '1.0.0'
|
version '1.0.1'
|
||||||
repository 'https://github.com/project-error/pe-lualib'
|
repository 'https://github.com/project-error/pe-lualib'
|
||||||
description 'A library of shared functions to utilise in other resources.'
|
description 'A library of shared functions to utilise in other resources.'
|
||||||
|
|
||||||
@@ -37,3 +37,7 @@ files {
|
|||||||
'imports/**/client.lua',
|
'imports/**/client.lua',
|
||||||
'imports/**/shared.lua',
|
'imports/**/shared.lua',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server_scripts {
|
||||||
|
'version.lua'
|
||||||
|
}
|
||||||
28
version.lua
Normal file
28
version.lua
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
CreateThread(function()
|
||||||
|
Wait(1000)
|
||||||
|
local resource = GetCurrentResourceName()
|
||||||
|
local url = GetResourceMetadata(resource, 'repository', 0)
|
||||||
|
local version = GetResourceMetadata(resource, 'version', 0)
|
||||||
|
|
||||||
|
PerformHttpRequest(('%s/master/fxmanifest.lua'):format(url:gsub('github.com', 'raw.githubusercontent.com')), function(error, response)
|
||||||
|
if error ~= 200 then
|
||||||
|
local latest = response:match('%d%.%d+%.%d+')
|
||||||
|
print(version, latest)
|
||||||
|
if version == latest then
|
||||||
|
local curMajor, curMinor = string.strsplit('.', version)
|
||||||
|
local newMajor, newMinor = string.strsplit('.', response:match('%d%.%d+%.%d+'))
|
||||||
|
local link = ('%s/archive/refs/tags/%s.zip'):format(url, latest, latest)
|
||||||
|
|
||||||
|
if tonumber(curMajor) < tonumber(newMajor) then
|
||||||
|
latest = 'A major update'
|
||||||
|
elseif tonumber(curMinor) < tonumber(newMinor) then
|
||||||
|
latest = 'An update'
|
||||||
|
else
|
||||||
|
latest = 'A patch'
|
||||||
|
end
|
||||||
|
|
||||||
|
print(('^3%s is available for oxmysql - please download the latest release (current version: %s)\n ^3- %s^0'):format(latest, version, link))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, 'GET')
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user