I want to remove the last 2 digits from this string and i can’t find out which method to use anymore. I already tried string:Sub() but that removes the first digits.
local function Corrected_String(String)
-- the string is: 00:01:00 and i want to remove the last 00
return String:sub(4) -- Problem here.
end
local function Game_Time(DT)
--// HANDLER //--
Lighting.ClockTime += (MinutesPerSecond / 60) * DT
Variables_Folder.Time.Value = Corrected_String(Lighting.TimeOfDay)
end
The first number string.sub takes is the start, so in your case it would be 1, and it also takes a 2nd number, the character to finish at, so you can put -4 (4 characters from the end of the string) there.
Can’t you seperate the string into tables using the colons? Then the third index would be the string you want to remove. So then you can use table.remove, and the last two zeroes are gone. (Hope this was helpful and the results are what you wanted.)
To split it, you would use something like this: string:split(“:”)