explodestring trouble
Hi,
I am trying to rewrite a large portion of one of my plugins so that it will read certain details from a file on plugin start, rather than having me recompile the entire plugin for minor changes. I looked into keyvalues but it seems at this point that a 2 dimensional string array would be my best bet since it is read very very frequently. I have read for hours on the subject and I cannot figure out how to get my string from the explodestring buffer to my primary array. As you can see below, I tried a simple array=buffer; statement but I believe that is invalid for arrays. Can anyone point me in the right direction? PHP Code:
|
Re: explodestring trouble
|
Re: explodestring trouble
Why not explode directly to your "primary" array? Also, see strcopy.
|
Re: explodestring trouble
You can assign same-sized arrays to each other.
|
Re: explodestring trouble
Quote:
|
Re: explodestring trouble
Maybe...
PHP Code:
|
Re: explodestring trouble
I think I may be going about this in the wrong way. What I am trying to do is, read two separate items per line from a text file, at the end of the file I want to have accomplished two things:
1) Count the amount of lines I just read in the file (I tried this by incrementing fLines in my example) 2) Store both items (on each line) so that they can be referenced individually, but always as a set (These will contain a STEAMID and a string, I tried to accomplish this with a 3D array but it is turning out to be more complex that I think it needs to be) I looked into keyvalues as an alternative but I only have a few items that need to be stored, and they will be accessed very frequently, so I believe storing this information as strings would be faster for this purpose. Can anyone advise me on a better approach to accomplish my goals? |
Re: explodestring trouble
Sorry, I'm not trying to bump here, but I am still stuck on this. If anyone could advise me on a better approach than this overly complicated 3d array. Like I mentioned before, this data will be accessed many times per minute using a three-expression for loop.
|
Re: explodestring trouble
Have a look at keyvalues again. Use keyvalue format in files. When loading, parse them into an enum structure with arrays (enum structure example: http://forums.alliedmods.net/showthr...96#post1023296).
Then you can loop through and read/write to arrays without having to worry about performance. |
Re: explodestring trouble
What he said!!! ^ ^ ^
|
All times are GMT -4. The time now is 06:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.