yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 08:35 AM |
alot of people in roblox are always running out of memory in data persistance becuase they save big numbers that are over 45000, so heres two functions i made so it will get that problem off of your back:
function SmartNumberSave(name, Value, player) x = tostring("Value") player:SaveString(name,x) end function SmartNumberLoad(name, player) y = tonumber(player:LoadString(name)) return y end |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 08:41 AM |
im a complete idiot here:
function SmartNumberSave(name, Value, player) x = tostring(Value) player:SaveString(name,x) end
function SmartNumberLoad(name, player) y = tonumber(player:LoadString(name)) return y end |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
| |
|
Snej1
|
  |
| Joined: 25 Jun 2008 |
| Total Posts: 809 |
|
|
| 09 Aug 2011 09:17 AM |
Doesn't numbers use less memory?
~ Chrome extensions FTW ~ |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 09:23 AM |
| no, the value of a number is the value of the bytes but the length of the string is the value of the bytes, that means that whit my functions you can you can save the number 45000 for 5 bytes and not 45000 bytes :D |
|
|
| Report Abuse |
|
|
zazw3
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1238 |
|
|
| 09 Aug 2011 10:04 AM |
| Genious...unlike my spelling......you know what i was trying to say....my 450000 though? |
|
|
| Report Abuse |
|
|
zazw3
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1238 |
|
|
| 09 Aug 2011 10:04 AM |
45000* gah floodcheck! and again! all i wat to do is correct myself!!! |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
| |
|
|
| 09 Aug 2011 10:20 AM |
Wait..... So saving the number "1000000", would use that many bytes? O_o |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 10:22 AM |
yes here:
as number: 1000000 bytes
as string: 7 bytes |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 10:23 AM |
Well that's stupid >_> I must work out a way to save pure numbers onto a harddrive so I can fill up all somebody's space >:D |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
| |
|
|
| 09 Aug 2011 10:36 AM |
Noo, but somebody's actual computer harddrive. So then if I ever gain acess to somebody's computer.... BAM. No more space on it :U
Say, that's a nice new PC game you have there. Such a shame you have no space to install it >:D |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 10:39 AM |
| lol it dosent work like that, 1 megabyte = 1000000 bytes so you will never be able to do something dangoreus |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 10:40 AM |
Yus, but if I managed to save the pure number 1000000000000 onto their harddrive, that'd be one terabyte gone :0 Or do real life bytes work differently to stinky ROBLOX bytes? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 10:42 AM |
Just by the way, before you actually listen to this guy, he has no idea what he's talking about. The number 45000 doesn't take 45000 bytes to save.
-Like a boss. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 10:43 AM |
@Crazy I thought it was a bit strange :/ *insert confused mug-shot here* |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 10:51 AM |
| hmm i dont remember how it went, can you show me a thread or a wiki page that shows the datacost of every method? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 10:52 AM |
http://wiki.roblox.com/index.php/DataComplexity
"Booleans and numbers cost 1 data complexity unit."
HMM
-Like a boss. |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 11:02 AM |
| then why when you use :SaveNumber("x",45001) it returns a error? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 11:04 AM |
-The DataReady could be false -You might not be on a ROBLOX game server -The Player might be nil -You could be doing a million other things wrong
-Like a boss. |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 11:07 AM |
well i guess your right, not!!!! TROLOLOL if you use my method you will get alot beter results
"Strings cost their length divided by 100 in data complexity units. "
that means that unless you use a number that is longer than 100, the data cost will be smaller than one
-like a bosses boss |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 11:10 AM |
I'm pretty sure that the string can't cost less than one data complexity unit.
So basically, use a number.
-Like a boss. |
|
|
| Report Abuse |
|
|
yoyoman2
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 2170 |
|
|
| 09 Aug 2011 11:14 AM |
| hmm i wonder how they did it so it will cost 1 byte for a number, its suppose to be impossible, number value = bit's, 8 bit's = 1 byte, so i dont understand the logic... |
|
|
| Report Abuse |
|
|