Udefault()

From TinyMUX
Jump to navigation Jump to search


FUNCTION: udefault([<obj>/]<attr>,<default case>[,<arg>]...)

This function returns the value of the user-defined function as defined by <attr> (or <obj>/<attr>), as if retrieved via the u() function, with <args>, if the attribute exists and is readable by you.

Otherwise, it evaluates the default case, and returns that. The default case is only evaluated if the attribute does not exist or cannot be read.

Example

> &TEST me=[center(%0,5,*)]

> say udefault(Test,-- BOOM --,ACK)

You say, "*ACK*"


> &TEST me

> say udefault(me/Test,-- BOOM --,ACK)

You say, "-- BOOM --"

Related Topics

get(), get_eval(), u(), default(), edefault()