The 0 doesn’t matter when the value is of type number, because 0x == x. However if you want to convert the number to a string(assuming you want to print it in a cool manner or show it somewhere), with preceding zeros, you can use the following code:
local n = 6 --amount of preceding zeros
local f = "%0"..n.."d" --string format
local x1 = 10000 --input 1
local x2 = 123 --input 2
print(string.format(f, x1)) --010000
print(string.format(f, x2)) --000123
For more context; It is for converting data like Vector3’s and stuff to something saveable and very compressed (a bit too compressed, making it too hard for myself)
the first two numbers are what type of data it is, and the proceeding numbers are information stored in data type. For example
local table = {
[“01”] = “Type”,
[“02”] = “Another Type”,
–[[
…
keeps on going till the double digits because
alotta data types
]]
}
– so if the number is
local number = 01001110
– first two numbers are 01, which means it is the type “Type”
– and the other numbers are just true or false, 0 for false, 1 for true.
table variable is just a dictionary for reference on what number is connected to which.
only doing this because i heard that numbers take up less storage than strings. (maybe a bit too much compression but im finding it out the hard way)
Its fine if the first question is not possible, atleast tell me if numbers take up less storage than strings statement is actually true.