Difference between revisions of "$prop"

From Scriptwiki
Jump to: navigation, search
m
m
Line 3: Line 3:
 
* This function has no parameters.
 
* 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)
 
   }
 
   }

Revision as of 22:47, 8 April 2008

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)
  }
return 0
}

In the above custom identifier, calling $value(2).square would return 4, $value(16).sqrt would return 4 and $value(3.14) would return 3.14