comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » getting structure elements by tag name string
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
getting structure elements by tag name string [message #33497] Wed, 08 January 2003 03:03 Go to previous message
s[1] is currently offline  s[1]
Messages: 21
Registered: December 2002
Junior Member
Hi all,

I try to use a structure as a bad substitute for a hash map (hashs or
associative lists or dictionaries or anything similar don't exist in
IDL, do they?)

Suppose I have a structure like this:
s = {a:7,b:9}

and I have a variable that contains a tag name:
tag = 'a'

Now I want to put the value of the structures element with name tag into a
new variable called value:
value = s.tag

This doesn't work of course, because tag is undefined for this structure.
But how can I get this the elements value?

I found a somewhat crude way:
res = execute('value =' + 's.' + tag)

That works, but it's really ugly. Is there a better way to do this?

And, is there a way to delete an element from a structure?

Thanks for all tips,

Sebastian
[Message index]
 
Read Message
Read Message
Previous Topic: Lost EXPONENT
Next Topic: Re: Getting running routine name

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:19:03 PDT 2025

Total time taken to generate the page: 0.00442 seconds