Difference between revisions of "$prop"
From Scriptwiki
m (spelling) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Returns the property of a custom alias. | Returns the property of a custom alias. | ||
$prop | $prop | ||
− | * This function has no | + | * This function has no parameters. |
== Example == | == Example == | ||
− | alias value { | + | [[alias]] value { |
− | if ($isid && $1 isnum) { | + | [[if]] ([[$isid]] && $1 isnum) { |
− | if (!$prop) return $1 | + | if (!$prop) [[return]] $1 |
− | elseif ($prop == squared) return $calc($1 ^ 2) | + | [[elseif]] ($prop == squared) return [[$calc|$calc($1 ^ 2)]] |
elseif ($prop == sqrt) return $calc($1 ^ 0.5) | elseif ($prop == sqrt) return $calc($1 ^ 0.5) | ||
} | } | ||
− | |||
} | } | ||
− | In the above custom identifier, calling $value( | + | In the above custom identifier, calling $value(4).squared would return 16, $value(4).sqrt would return 2 and $value(3.14) would return 3.14. |
[[Category:Identifiers]] | [[Category:Identifiers]] | ||
+ | [[Category:Aliases]] |
Latest revision as of 17:26, 29 November 2009
Returns the property of a custom alias.
$prop
- This function has no parameters.
Example
alias value { if ($isid && $1 isnum) { if (!$prop) return $1 elseif ($prop == squared) return $calc($1 ^ 2) elseif ($prop == sqrt) return $calc($1 ^ 0.5) } }
In the above custom identifier, calling $value(4).squared would return 16, $value(4).sqrt would return 2 and $value(3.14) would return 3.14.