rojo/plugin/src/Config.lua
Joe dcd9253770 Refactor version rejection logic in ApiContext
- Renamed the `rejectWrongProtocolVersion` function to `rejectWrongVersion` for clarity.
- Enhanced version mismatch handling by providing detailed error messages when the plugin and server versions do not match.
- Updated the expected server version format in the configuration to include the patch version, ensuring accurate version checks.

These changes improve error reporting and version management in the plugin's API context.
2026-02-17 20:48:39 -06:00

34 lines
1 KiB
Lua

local strict = require(script.Parent.strict)
local isDevBuild = script.Parent.Parent:FindFirstChild("ROJO_DEV_BUILD") ~= nil
local Version = script.Parent.Parent.Version
local trimmedVersionValue = Version.Value:gsub("^%s+", ""):gsub("%s+$", "")
local major, minor, patch, metadata = trimmedVersionValue:match("^(%d+)%.(%d+)%.(%d+)(.*)$")
local realVersion = { major, minor, patch, metadata }
for i = 1, 3 do
local num = tonumber(realVersion[i])
if num then
realVersion[i] = num
else
error(("invalid version `%s` (field %d)"):format(realVersion[i], i))
end
end
-- ClassNames to ignore during sync (auto-created by Roblox, not meaningful for sync)
local IgnoredClassNames = {
TouchTransmitter = true,
Camera = true,
}
return strict("Config", {
isDevBuild = isDevBuild,
codename = "Epiphany",
version = realVersion,
expectedServerVersionString = ("%d.%d.%d"):format(realVersion[1], realVersion[2], realVersion[3]),
protocolVersion = 6,
defaultHost = "localhost",
defaultPort = "34873",
ignoredClassNames = IgnoredClassNames,
})