rewrite(phase4): srry i have no choice :(

This commit is contained in:
khtsly 2026-02-13 20:23:14 +07:00
parent 36b03dec02
commit 5f5bb7938c

View file

@ -1,7 +1,7 @@
--!optimize 2 --!optimize 2
--!native --!native
--@EternityDev --@EternityDev
local BITS: number = 8 local BITS: number = 16
local MAX_VALUE: number = bit32.lshift(1, BITS) - 1 local MAX_VALUE: number = bit32.lshift(1, BITS) - 1
local cache: { [string]: number } = {} local cache: { [string]: number } = {}
@ -13,7 +13,7 @@ return function(name: string): number
if cached then if cached then
return cached return cached
end end
if count >= MAX_VALUE then if count >= 255 then -- 255 is safer from collision
warn("ran out of ids :(") warn("ran out of ids :(")
return 0 return 0
end end