local count = tostring(int) |
local index = -1 |
|
local last = frac |
|
local roll = false; |
for idx,digit in ipairs(digits) do |
local num = count:sub(index,index) |
index = index - 1 |
|
if tonumber(num) then |
num = tonumber(num) |
digit:SetTexCoord(getcoords(num, last)) |
-- last = num / 10 |
last = nil |
|
if idx == 1 then |
if num == 9 then |
roll = true |
end |
end |
|
if idx == 1 then |
digit:SetTexCoord(getcoords(num, frac)) |
elseif roll then |
-- The last digit is rolling over now, so let's see if we need to |
-- digit.current is the number we're currently displaying |
local new = tostring(count + 1):sub(index+1, index+1) |
if new ~= digit.current then |
digit:SetTexCoord(getcoords(num, frac)) |
else |
digit:SetTexCoord(getcoords(num)) |
end |
else |
digit:SetTexCoord(getcoords(num)) |
end |
digit.current = num |
else |
digit:SetTexCoord(getcoords(0)) |
if roll and idx <= #tostring(int + 1) then |
digit:SetTexCoord(getcoords(0, frac)) |
end |
end |
end |
end |