gmtk-2024/util.lua

20 lines
476 B
Lua

function player_power_to_string(n)
str = ""
while n > 999 do
last_segment = n%1000
n = n - last_segment
if last_segment > 99 then
str = "." .. last_segment ..str
elseif last_segment > 9 then
str = ".0" .. last_segment ..str
else
str = ".00" .. last_segment ..str
end
n = n /1000
end
str = n..str
while #str < 16 do
str = " "..str
end
return str
end