View Full Version : Lich question
Vindicate
05-18-2010, 10:35 PM
def find_foes( *critters )
start_script( 'walk', critters )
# other stuff
end
targets = [ "crawler", "cerebralite" , "souls" , "kobold" ]
find_foes (targets )
The target variable passes as one long word.
any help would be appreciated.
Tillmen
05-19-2010, 01:36 AM
Get rid of the star.
SpiffyJr
05-19-2010, 08:21 AM
The asterisk (splat operator) in front of critters denotes that your definition takes variable length arguments so in this case I'm not sure you want that. If you're trying to ECHO critters you're going to receive a string representation of the array which would be:
crawlercerabralitesoulskobold
If you want to view how the array actually looks you should do something like:
echo critters.inspect
Vindicate
05-19-2010, 10:01 AM
Yep, removing the asterisk did the job.
The array is now correctly read by the "walk" script.
The idea was to dynamically change the targets array depending on the situation.
Thank guys.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.