Dumping key/value pairs from TMap
BlitzMax Forums/BlitzMax Programming/Dumping key/value pairs from TMap
| ||
Anyone? I've tried anything. The iterators work fine for dumping just the keys, but otherwise I'm lost :) Thanks in advance |
| ||
If you've got the keys, can't you just look up the values? |
| ||
What do you mean by 'dumping'? |
| ||
I mean retrieving the keys in a list. But yes I could look up the values, but in other languages you can get a value/pair struct for each. Oh well :) |
| ||
Maybe this helps you: |
| ||
Hi, Yes, the 'new' TMap doesn't have a way of traversing Key/Value pairs yet, as I realized today at work! Will be fixed soon, but in the meantime you're stuck with using ValueForKey() inside a key loop. |
| ||
Any idea when we might expect this? Or a suggestion of how I could fix it myself by extending TMap? I've hit a bit of a dead end in my work because of this, and I can't see any way around it. EDIT: Actually, forget extending it. For now, if I could just flat copy it lock, stock to a new module and make some changes, it would get me through until it's fixed. |
| ||
Here's an example I whipped up while trying to figure out how to do this myself. I apologize for the ultra sloppy code |
| ||
Ah, thanks for the example and explanation. We're safe using fields prefixed with _ are we? I thought perhaps they were subject to change or something. |
| ||
if fields with _ would be a problem, many 3rd party stuff would get in serious trouble as most (including me) use it to mark something as private :) |
| ||
That was precisely my point. If they're "private", we shouldn't be using them, and they may be subject to change. |