iShareSize
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

iShareSize

Started by 6Marilyn6Manson6, 21 May, 2006, 13:52:54

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

6Marilyn6Manson6

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

PPK

No is not possible  :o
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

6Marilyn6Manson6

Quote from: PPK on 21 May, 2006, 22:50:25
No is not possible? :o

Why PPK? Explain to me please :)

GeceBekcisi

#3
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
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

PPK

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 ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

bastya_elvtars

The soulution is easier for you to script than to code into pxlua and use up more RAM.
Everything could have been anything else and it would have just as much meaning.

6Marilyn6Manson6

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

PPK

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
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

6Marilyn6Manson6

Ok ok PPK, thanks a lot to all :)

SMF spam blocked by CleanTalk