Jump to content

[SOLVED]Help needed!


SpecT

Recommended Posts

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 by Guest
Link to comment

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
     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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...