Difference between revisions of "Intrinsic Functions"
From SphereWiki
MrSugarCube (talk | contribs) (Created page with 'Intrinsic functions are special functions that can only be used within evaluation functions, such as EVAL, FEVAL, FHVAL, FVAL and HVAL. Some of the builtin fu...') |
m |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | Intrinsic functions are special functions that can only be used within evaluation functions, such as [[EVAL]], [[FEVAL]], [[FHVAL]], [[FVAL]] and [[ | + | {{Languages|Intrinsic_Functions}} |
+ | |||
+ | Intrinsic functions are special functions that can only be used within evaluation functions, such as [[EVAL]], [[FEVAL]], [[FHVAL]], [[FVAL]], [[HVAL]], and [[UVAL]]. Some of the builtin functions and properties will automatically evaluate their parameters, for example the [[IF]], [[WHILE]] statements will automatically evaluate their conditions. | ||
Line 12: | Line 14: | ||
{| border="1" cellspacing="4" cellpadding="4" | {| border="1" cellspacing="4" cellpadding="4" | ||
| '''Name''' || '''Description''' | | '''Name''' || '''Description''' | ||
+ | |- | ||
+ | |[[ABS]](''value'') || Returns the absolute ''value'' of a number. | ||
|- | |- | ||
| [[COS]](''value'') || Returns the cosine of ''value''. | | [[COS]](''value'') || Returns the cosine of ''value''. | ||
Line 19: | Line 23: | ||
| [[ISOBSCENE]](''text'') || Returns 1 if ''text'' is considered to contain obscene language. | | [[ISOBSCENE]](''text'') || Returns 1 if ''text'' is considered to contain obscene language. | ||
|- | |- | ||
− | | [[ | + | | [[ISNUMBER]](''value'') || Returns 1 if ''value'' is a number. |
|- | |- | ||
| [[LOGARITHM]](''value'') || Returns the base-10 logarithm of ''value''. | | [[LOGARITHM]](''value'') || Returns the base-10 logarithm of ''value''. |
Latest revision as of 23:43, 12 May 2015
Missing languages
Intrinsic functions are special functions that can only be used within evaluation functions, such as EVAL, FEVAL, FHVAL, FVAL, HVAL, and UVAL. Some of the builtin functions and properties will automatically evaluate their parameters, for example the IF, WHILE statements will automatically evaluate their conditions.
Unlike the syntax for normal functions (<FUNCTION args>), the syntax for returning a value from an instrinsic function is:
FUNCTION(args)
The following table details all of the intrinsic functions in SphereServer:
Name | Description |
ABS(value) | Returns the absolute value of a number. |
COS(value) | Returns the cosine of value. |
ID(defname) | Returns the numeric value of defname. |
ISOBSCENE(text) | Returns 1 if text is considered to contain obscene language. |
ISNUMBER(value) | Returns 1 if value is a number. |
LOGARITHM(value) | Returns the base-10 logarithm of value. |
LOGARITHM(value, base) | Returns the base-base logarithm of value. (Accepts "e" and "pi" as bases, as well as numeric values) |
NAPIERPOW(value) | Returns e (2.7182818) to the power of value. |
QVAL(a, b, less_than, equal_to, greater_than) | Returns less_than if a is less than b, equal_to is a is equal to b, or greater_than if a is greater than b. |
RAND(value) | Returns a random value between 0 value-1. |
RAND(min, max) | Returns a random value between min and max. |
RANDBELL(value, variance) | Calculates a value based on a bell-shaped curve. |
SIN(value) | Returns the sine of value. |
STRCMP(string1, string2) | Compares string1 to string2 and returns the result. Case-sensitive. (<= 1 = string1 less than string2, 0 = string1 equal to string2, >= 1 = string1 greater than string2) |
STRCMPI(string1, string2) | Compares string1 to string2 and returns the result. Case-insenstive. (<= 1 = string1 less than string2, 0 = string1 equal to string2, >= 1 = string1 greater than string2) |
STRINDEXOF(text, search, n) | Returns the index of the search string within text, starting from the nth character. (zero-based) |
STRLEN(text) | Returns the length of text. |
STRMATCH(pattern, text) | Returns 1 if text matches the specified wildcard pattern. |
STRREGEX(pattern, text) | Returns 1 if text matches the specified regular expression pattern. |
SQRT(value) | Returns the square root of value. |
TAN(value) | Returns the tangent of value. |