<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/15950" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2008-07-28T09:36:01-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/15950</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-07-28T09:36:01-04:00</updated>

		<published>2008-07-28T09:36:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84212#p84212</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84212#p84212"/>
		<title type="html"><![CDATA[Custom options in procedures]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84212#p84212"><![CDATA[
I believe you are looking for the special parameter called "args", which accepts 0 or more values..<br><div class="codebox"><p>Code: </p><pre><code>proc proc1 {string1 string2 args} { #Instantiate option-variables  set nocase 0 #Do we have any options to care for? if {[llength $args] &gt; 0} {  #Iterate through the whole list of options...  foreach arg $args {   #... and parse each to see if they're valid or not.   #Use the "default" keyword to catch any unknown options and bail out.   switch -- $arg {    "-nocase" {     set nocase 1    }    default {     error "Unknown option \"$arg\""    }   }  } } #All options (if any) parsed, and option-variables properly updated, # lets do the actual work now ...}</code></pre></div>Of course, this could also be done in some manner using default values, although ordering would become an issue. The above example still requires the first two parameters to be the strings to be operated on, however, should you support numerous options, the order among those would not matter. With some modification, you could also support options with values, such as "[proc2 word1 word2 -format "%s - %s"]"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Jul 28, 2008 9:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[FallFromGrace]]></name></author>
		<updated>2008-07-28T08:55:48-04:00</updated>

		<published>2008-07-28T08:55:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84211#p84211</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84211#p84211"/>
		<title type="html"><![CDATA[Custom options in procedures]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84211#p84211"><![CDATA[
i can make default values in my procs, f.e. proc1 {string1 string2 {nocase false}}... but how can i make options? <br><br>"[proc1 "asd" "qwe" -nocase]", is it possible?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10083">FallFromGrace</a> — Mon Jul 28, 2008 8:55 am</p><hr />
]]></content>
	</entry>
	</feed>
