KeyValues with unknown Key's
Hi all,
i want to read all values from a config file via "KeyValues". But the Key's are unknow. It's no problem when i know the name of the "key" but i didn't. Example: Code:
"MyFile" PHP Code:
Code:
E.x. de_dust: Thanks for the effort. |
Re: KeyValues with unknown Key's
You may have to parse keys yourself manually, using readfileline
|
Re: KeyValues with unknown Key's
Quote:
HSFighter: It is possible to iterate through those. Valve refers to KV items that have values (and thus no children) as Values, which is what might have thrown you off from finding the solution on your own. Both KvGotoFirstSubKey and KvGotoNextKey have an optional second value named keysOnly. When this is set to true (the default), it will only go through the Key items. When this is set to false, it will only go through the Value items. One more important thing: To retrieve the value of the current Value item, you have to pass NULL_STRING as the key name. This is mentioned as a valid argument for the key name, but the documentation doesn't mention what it does. So, to fetch them all is something like this: PHP Code:
|
Re: KeyValues with unknown Key's
Thank You Powerlord :P:bacon!:, very interesting.
I get only the first Char back. Then i set the Size of Array for the time being to 128. After this i get some funny Results. Result from the First Key / Value: Code:
Debug: ArrayKey: KValKValue_mpai PHP Code:
PHP Code:
- |
Re: KeyValues with unknown Key's
Whoops. Since you're storing Strings, your array needs a third dimension with the string length.
|
Re: KeyValues with unknown Key's
That's it!
Thank you very much. :bacon!: |
All times are GMT -4. The time now is 10:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.