MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: How do I protect a wiz-owned :enterfunc?



On Wed, 27 Nov 1996, Gevan Dutton wrote:

> 
> 	On Wed, 27 Nov 1996, Francis Litterio wrote:
> 
> 	I must protect the verb so that it can only be called by the
> 	server and never by a programmer or another verb.  But when the
> 	1.8.0p5 server calls :enterfunc, caller and player are both set to
> 	something _other_ than #-1. 
> 	What check can I do to enforce that the :enterfunc is only
> 	called from the server? 
> 
> Well, if you want to be really sure (and probably there's a better way):
>   last_activ = callers()[$];
>   if (last_activ[4]!=#-1 && last_activ[3]!=#-1 && last_activ[2]==""))
>     "caller was not a builtin function";
>     raise(E_PERM);
>   endif
>   ...	  

Do I feel stupid.  Took out a negation and forgot to switch the operators -

  if (last_activ[4]!=#-1 || last_activ[3]!=#-1 || last_activ[2]=="")

or, as someone else pointed out

  if (last_activ[4]!=#-1 || last_activ[3]!=#-1 || last_activ[2]!="move")


References:

Home | Subject Index | Thread Index