user.iShareSize = return iShareSize in byte.
Is it possible change iShareSize in other? For example: iShareSize change in: iShareSizeBYTE - iShareSizeKBYTE - iShareSizeMBYTE - iShareSizeGBYTE - iShareSizeTBYTE. Thanks :P
No is not possible :o
Quote from: PPK on 21 May, 2006, 22:50:25
No is not possible? :o
Why PPK? Explain to me please :)
6Marilyn6Manson6 why don't you simply use a code like the one below?
BYTEtoSHARE = function(iBytes)
if iBytes then
if iBytes > 1024^5 then
return string.format( "%.2f",iBytes/1024^5).." PiB"
elseif (1024^5 > iBytes) and (iBytes > 1024^4) then
return string.format( "%.2f",iBytes/1024^4).." TiB"
elseif (1024^4 > iBytes) and (iBytes > 1024^3) then
return string.format( "%.2f",iBytes/1024^3).." GiB"
elseif (1024^3 > iBytes) and (iBytes > 1024^2) then
return string.format( "%.2f",iBytes/1024^2).." MiB"
elseif (1024^2 > iBytes) and (iBytes > 1024) then
return string.format( "%.2f",iBytes/1024).." KiB"
elseif (1024 > iBytes) then
return (iBytes).." B"
end
else
return "0 B"
end
end
Yes as say GeceBekcisi, why you dont use script... because is not possible want from PtokaX to create all share types on any user object creating ::)
The soulution is easier for you to script than to code into pxlua and use up more RAM.
Yes, I know. For example I can use this part:
DoShareUnits = function(intSize)
if intSize ~= 0 then
local tUnits = { "Bytes", "KiB", "MiB", "GiB", "TiB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end
end
return string.format("%0.3f %s",intSize, sUnits);
else
return "0 Bytes"
end
end
but if PPK added this: iShareSizeBYTE - iShareSizeKBYTE - iShareSizeMBYTE - iShareSizeGBYTE - iShareSizeTBYTE, script is most easy and short :P
Quote from: bastya_elvtars on 22 May, 2006, 00:02:28
than to code into pxlua and use up more RAM.
Not ram, but cpu... ::)
Quote from: 6Marilyn6Manson6 on 22 May, 2006, 03:36:12
script is most easy and short :P
Sorry but here will not be support for lazy scripters :P
Ok ok PPK, thanks a lot to all :)