mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 23:16:03 +01:00
Send 'true' to match old behaviour (print message, return nil). New behaviour has no output unless sending a third argument.
16 lines
473 B
Lua
16 lines
473 B
Lua
function lib.checkDependency(resource, minimumVersion, printMessage)
|
|
local currentVersion = GetResourceMetadata(resource, 'version', 0):match('%d%.%d+%.%d+')
|
|
|
|
if currentVersion < minimumVersion then
|
|
local msg = ("^1%s requires version '%s' of '%s' (current version: %s)^0"):format(GetInvokingResource() or GetCurrentResourceName(), minimumVersion, resource, currentVersion)
|
|
|
|
if printMessage then
|
|
return print(msg)
|
|
end
|
|
|
|
return false, msg
|
|
end
|
|
|
|
return true
|
|
end
|