Jump to content

Creating a percentage from an amount of bytes


novo

Recommended Posts

Hello,

I want to create a percentage from an amout of bytes.

I'm having the following code;

  
    local bytes = 0 
    for i,v in ipairs(clientCreate) do 
        local bytes = bytes + fileGetSize(":"..res.."/"..v) 
    end 
    local percent = bytes/100 
  

Now I want to take a % from the percent I just created by comparing, here:

Lets think that the bytes is equal to 54000 B

  
local bytes = 54000 
local percent = 54000/100 
local percent = 540 --% 
  

Now I want to know what % would be if I'm having 50000 B instead of 54000, 4000 B are left.

I hope you understood me!

Thanks in advance.

Link to comment

Well, as far I know I'm not the only one who doesn't know maths very well.

By the way, I searched on the internet and I didn't understand what the people meant and that's why I came here to ask.

And, the education and the respect aren't your strong suits I see.

Link to comment

novo, you need some skill in Physics and more skill in Mathematics for programming/scripting.

"And, the education and the respect aren't your strong suits I see", ffs-racing is being honest and seriously - education?

I don't have any respect for noobs, I have respect for newbies though. I have respect to people who really want to code. I don't have respect for people who don't try and bother everyone else because of it.

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