How do I populate a hash in a foreach loop? I have a vector of about a hundred object names and I want a hash of property nodes with the key for each being the object name, and the node tied to a property like so:
lights = ['blinky1, 'blinky2']; turnOn = func(someNode) { # do some stuff with someNode } foreach(light; lights) { propertyPath = 'some/path/'~light; # do magic to the hash lightNodes here # So that a node linked to propertyPath # with a key of light gets added to lightNodes } # Then I can pick a node out of lightNodes by knowing the name of the # object it deals with. turnOn(lightNodes['blinkey1']); I should probably also make a new method for props.Node if I can to avoid mixing a procedural function and a node, but this will work for now. Josh ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel