Files
YataiDONNijiiro/Scripts/background/bg_objects/packed_channel.lua
T
2026-11-23 11:20:21 -05:00

24 lines
542 B
Lua

local byte = string.byte
local DIGIT = {}
do
local d = 0
for c = 33, 126 do
if c ~= 34 and c ~= 92 then
DIGIT[c] = d
d = d + 1
end
end
end
return function(v, i)
if type(v) == "number" then return v end
local s = v[4]
if type(s) ~= "string" then return v[i] end -- a plain table: one value per frame
local w = v[3]
local p = (i - 1) * w
local n = DIGIT[byte(s, p + 1)]
for k = p + 2, p + w do n = n * 92 + DIGIT[byte(s, k)] end
return v[1] + v[2] * n
end