nss_libs - VersionCheck
This module provides a simple way to check if the client is using the latest version of a resource.
Version JSON Structure
json
{
"version": "0.0.2",
"versions": [
"0.0.1",
"0.0.2"
],
"dependencies": {
"0.0.1": {
"nss_libs": "0.21.1"
},
"0.0.2": {
"nss_libs": "0.22.0"
}
},
"last_allowed_version": "0.0.1"
}| Field | Type | Description |
|---|---|---|
version | string | Required. The up-to-date version of the resource |
versions | string[] | Optional. List of all versions so the DatabaseUpdater module can update the database |
last_allowed_version | string | Optional. The last version allowed to be used by the game server. Older versions will be stopped |
dependencies | table | Optional. Map of version to its minimum dependency versions |
WARNING
If last_allowed_version is set and the game server uses an older version, the related resource will be stopped. This is useful to force an update. Ensure that the version check url is not reachable in unencrypted files to prevent manipulations.
Example
lua
---@type PackageVersionCheckApi
local version_check_api = exports.nss_libs:getVersionCheckApi(GetCurrentResourceName())
version_check_api:check("https://github.com/NIGHTSHIFT-STUDIO/nss_versions/blob/main/nss_quest.json")Console Output
log
✅ Up to Date! nss_quest (Installed 1.0.2)log
❌ Outdated! nss_quest (Installed 1.0.0, Available 1.0.2)log
⚠ Unsupported! nss_quest (Installed 1.0.3, Available 1.0.2)