From: pdbogen Date: Mon, 12 Dec 2011 16:06:40 +0000 (+0000) Subject: Allow random to accept comma-delimited lists, but retain old behavior in case of... X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=455e4146fb2d22abf1b8f007fccf211caf45447e;p=destult.git Allow random to accept comma-delimited lists, but retain old behavior in case of spaces-only. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@121 088b83a4-0077-4247-935c-42ec02c2848b --- diff --git a/commands.yaml b/commands.yaml index be831e0..0b9bf10 100644 --- a/commands.yaml +++ b/commands.yaml @@ -732,7 +732,12 @@ ADVERTISE: |- RANDOM: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; - my @opts = split( / /, $what ); + my @opts; + if( $what =~ m/,/ ) { + @opts = split( /\s*,\s*/, $what ); + } else { + @opts = split( / /, $what ); + } if( $#opts >= 0 ) { $kernel->post( $src, $replypath, $opts[ int( rand( $#opts+1 ) ) ], $dest ); }