<HTML> <HEAD> <!-- This HTML file has been created by texi2html 1.51 from ProgrammersManual.texinfo on 4 March 1997 --> <TITLE>LambdaMOO Programmer's Manual - Property Functions</TITLE> </HEAD> <BODY> Go to the <A HREF="ProgrammersManual_1.html">first</A>, <A HREF="ProgrammersManual_48.html">previous</A>, <A HREF="ProgrammersManual_50.html">next</A>, <A HREF="ProgrammersManual_77.html">last</A> section, <A HREF="ProgrammersManual_toc.html">table of contents</A>. <P><HR><P> <H4><A NAME="SEC49" HREF="ProgrammersManual_toc.html#TOC49">Operations on Properties</A></H4> <P> <DL> <DT><U>Function:</U> list <B>properties</B> <I>(obj <VAR>object</VAR>)</I> <DD><A NAME="IDX63"></A> Returns a list of the names of the properties defined directly on the given <VAR>object</VAR>, not inherited from its parent. If <VAR>object</VAR> is not valid, then <CODE>E_INVARG</CODE> is raised. If the programmer does not have read permission on <VAR>object</VAR>, then <CODE>E_PERM</CODE> is raised. </DL> </P> <P> <DL> <DT><U>Function:</U> list <B>property_info</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>)</I> <DD><A NAME="IDX64"></A> <DT><U>Function:</U> none <B>set_property_info</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>, list <VAR>info</VAR>)</I> <DD><A NAME="IDX65"></A> These two functions get and set (respectively) the owner and permission bits for the property named <VAR>prop-name</VAR> on the given <VAR>object</VAR>. If <VAR>object</VAR> is not valid, then <CODE>E_INVARG</CODE> is raised. If <VAR>object</VAR> has no non-built-in property named <VAR>prop-name</VAR>, then <CODE>E_PROPNF</CODE> is raised. If the programmer does not have read (write) permission on the property in question, then <CODE>property_info()</CODE> (<CODE>set_property_info()</CODE>) raises <CODE>E_PERM</CODE>. Property info has the following form: </P> <PRE> {<VAR>owner</VAR>, <VAR>perms</VAR> [, <VAR>new-name</VAR>]} </PRE> <P> where <VAR>owner</VAR> is an object, <VAR>perms</VAR> is a string containing only characters from the set <SAMP>`r'</SAMP>, <SAMP>`w'</SAMP>, and <SAMP>`c'</SAMP>, and <VAR>new-name</VAR> is a string; <VAR>new-name</VAR> is never part of the value returned by <CODE>property_info()</CODE>, but it may optionally be given as part of the value provided to <CODE>set_property_info()</CODE>. This list is the kind of value returned by <CODE>property_info()</CODE> and expected as the third argument to <CODE>set_property_info()</CODE>; the latter function raises <CODE>E_INVARG</CODE> if <VAR>owner</VAR> is not valid, if <VAR>perms</VAR> contains any illegal characters, or, when <VAR>new-name</VAR> is given, if <VAR>prop-name</VAR> is not defined directly on <VAR>object</VAR> or <VAR>new-name</VAR> names an existing property defined on <VAR>object</VAR> or any of its ancestors or descendants. </DL> </P> <P> <DL> <DT><U>Function:</U> none <B>add_property</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>, <VAR>value</VAR>, list <VAR>info</VAR>)</I> <DD><A NAME="IDX66"></A> Defines a new property on the given <VAR>object</VAR>, inherited by all of its descendants; the property is named <VAR>prop-name</VAR>, its initial value is <VAR>value</VAR>, and its owner and initial permission bits are given by <VAR>info</VAR> in the same format as is returned by <CODE>property_info()</CODE>, described above. If <VAR>object</VAR> is not valid or <VAR>info</VAR> does not specify a valid owner and well-formed permission bits or <VAR>object</VAR> or its ancestors or descendants already defines a property named <VAR>prop-name</VAR>, then <CODE>E_INVARG</CODE> is raised. If the programmer does not have write permission on <VAR>object</VAR> or if the owner specified by <VAR>info</VAR> is not the programmer and the programmer is not a wizard, then <CODE>E_PERM</CODE> is raised. </DL> </P> <P> <DL> <DT><U>Function:</U> none <B>delete_property</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>)</I> <DD><A NAME="IDX67"></A> Removes the property named <VAR>prop-name</VAR> from the given <VAR>object</VAR> and all of its descendants. If <VAR>object</VAR> is not valid, then <CODE>E_INVARG</CODE> is raised. If the programmer does not have write permission on <VAR>object</VAR>, then <CODE>E_PERM</CODE> is raised. If <VAR>object</VAR> does not directly define a property named <VAR>prop-name</VAR> (as opposed to inheriting one from its parent), then <CODE>E_PROPNF</CODE> is raised. </DL> </P> <P> <DL> <DT><U>Function:</U> int <B>is_clear_property</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>)</I> <DD><A NAME="IDX68"></A> <DT><U>Function:</U> none <B>clear_property</B> <I>(obj <VAR>object</VAR>, str <VAR>prop-name</VAR>)</I> <DD><A NAME="IDX69"></A> These two functions test for clear and set to clear, respectively, the property named <VAR>prop-name</VAR> on the given <VAR>object</VAR>. If <VAR>object</VAR> is not valid, then <CODE>E_INVARG</CODE> is raised. If <VAR>object</VAR> has no non-built-in property named <VAR>prop-name</VAR>, then <CODE>E_PROPNF</CODE> is raised. If the programmer does not have read (write) permission on the property in question, then <CODE>is_clear_property()</CODE> (<CODE>clear_property()</CODE>) raises <CODE>E_PERM</CODE>. If a property is clear, then when the value of that property is queried the value of the parent's property of the same name is returned. If the parent's property is clear, then the parent's parent's value is examined, and so on. If <VAR>object</VAR> is the definer of the property <VAR>prop-name</VAR>, as opposed to an inheritor of the property, then <CODE>clear_property()</CODE> raises <CODE>E_INVARG</CODE>. </DL> </P> <P><HR><P> Go to the <A HREF="ProgrammersManual_1.html">first</A>, <A HREF="ProgrammersManual_48.html">previous</A>, <A HREF="ProgrammersManual_50.html">next</A>, <A HREF="ProgrammersManual_77.html">last</A> section, <A HREF="ProgrammersManual_toc.html">table of contents</A>. </BODY> </HTML>