Jump to content

[HELP] How to convert bytes to megabytes?


Turbesz

Recommended Posts

I use "onClientTransferBoxProgressChange" in my script, and i don't know, how to convert the totalSize argument (bytes) to megabytes.

I tried this way without success:

addEventHandler("onClientTransferBoxProgressChange", root, function(downloadedSize, totalSize)
    megabytes = math.floor(totalSize / 1024)
end)

anyone can help me?

Link to comment

Hey,

You could simply just search on google for the formula to convert bytes to megabytes.
Formula: megabytes = bytes / 1024 / 1024

So in your case:

megabytes = math.floor(totalSize / 1024 / 1024)

 

Edited by SpecT
  • Thanks 1
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...