SpecT Posted April 29, 2015 Share Posted April 29, 2015 (edited) Hello guys! So I want to convert length value like "3:41" to a normal value and in milliseconds. How can I do this? Hope that you can understand what I mean and will help me. Thanks in advance! Edited April 29, 2015 by Guest Link to comment
WhoAmI Posted April 29, 2015 Share Posted April 29, 2015 local s = "3:41"; local minutes, seconds = split ( s, ":" ); Link to comment
SpecT Posted April 29, 2015 Author Share Posted April 29, 2015 (edited) local s = "3:41"; local minutes, seconds = split ( s, ":" ); o.0 Thanks man! Edited April 29, 2015 by Guest Link to comment
SpecT Posted April 29, 2015 Author Share Posted April 29, 2015 I need some more help ... This is the code I'm using: local length = songData[song][1] local lengthData = split ( length, ":" ) local minutes = lengthData[1] local seconds = lengthData[1] local length = (minutes*60 + seconds)*1000 outputChatBox(length.." | "..minutes..":"..seconds) The problem is that - for example the length is 4:27. After the converting it shows 4:4. How can get this fixed ? Link to comment
WhoAmI Posted April 29, 2015 Share Posted April 29, 2015 local length = songData[song][1] local minutes, seconds = unpack ( split ( length, ":" ) ) local length = (minutes*60 + seconds)*1000 outputChatBox(length.." | "..minutes..":"..seconds) Link to comment
SpecT Posted April 29, 2015 Author Share Posted April 29, 2015 local length = songData[song][1] local minutes, seconds = unpack ( split ( length, ":" ) ) local length = (minutes*60 + seconds)*1000 outputChatBox(length.." | "..minutes..":"..seconds) Finally it works just fine. Thanks again mate! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now