Version 6 of args

Updated 2004-12-09 14:30:02

Special name for an argument to a proc - if it's last in the argument list, it will contain a list (possibly empty) of all the remaining arguments.

example args

Player proc show_players args {

  if { [string length $args] == 0} {
    puts "Show players DB"
    foreach p [my info instances] {
      puts "[$p name] [$p position]"
    }
    return
  }

  set pos [string toupper $args]
  puts "Players with postition $pos:"
  foreach p [my info instances] {
    foreach char [split $pos {}] {
      if {[string first $char [$p position]] == 1} {
        puts "[$p name] [$p position]"
        break
      }
    }
  }

}