Is there a way to have a variable as 01 rather than 1? I have it set to that, but whenever I do "unitnum = unitnum + 01;" it just gets rid of the zero. I need these for writing strings of values for a Play-by-Email game I'm making. (using AMS to make the army builder)
Placeholder zeros
Collapse
X
-
You could cheat and do something like this.
if String.Length(unitnum) == 1 then
unitnum = "0"..unitnum
end
The issue is that unitnum is a nurmeric variable, so the leading 0 is dropped. Once you combine the string variable "0" with it, it becomes a string, and the 0 leads as you want.
-
-
LUA has a string.format (all lowercase) that can do this as well.
Code:num = 1 num = string.format("%02.f", num) Label.SetText("Label1", num);
TJ-Tigger
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
"Draco dormiens nunquam titillandus."
Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine
Comment
-
-
Originally posted by CoreyNice one Tigg! :yesTJ-Tigger
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
"Draco dormiens nunquam titillandus."
Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine
Comment
-
Comment