From 36b03dec02e0ba15f674e248f39f44f842f83121 Mon Sep 17 00:00:00 2001 From: khtsly Date: Fri, 13 Feb 2026 19:58:04 +0700 Subject: [PATCH] rewrite(phase4): add count validation --- src/Util/Identifier.luau | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Util/Identifier.luau b/src/Util/Identifier.luau index 8cbc4f4..c19e079 100644 --- a/src/Util/Identifier.luau +++ b/src/Util/Identifier.luau @@ -6,12 +6,17 @@ local MAX_VALUE: number = bit32.lshift(1, BITS) - 1 local cache: { [string]: number } = {} local hash: number = game.PlaceVersion + 5381 +local count: number = 0 return function(name: string): number local cached = cache[name] if cached then return cached end + if count >= MAX_VALUE then + warn("ran out of ids :(") + return 0 + end local b: number = hash for i = 1, #name do @@ -20,5 +25,6 @@ return function(name: string): number local reduced = bit32.band(b, MAX_VALUE) cache[name] = reduced + count += 1 return reduced end