User Tools

Site Tools


conditional_expression

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
conditional_expression [2017/08/06 12:24]
justin
conditional_expression [2017/08/06 12:45] (current)
justin
Line 2: Line 2:
 ---- ----
  
-A **conditional expression** is an expression that evaluates to either true or false. An operatorat the middle of the expressionis used to compare two different values on each side (i.e. the left operand and right operand).+A **conditional expression** is an expression that evaluates to either true or false. An operator at the middle of the expression ​(for example "​=="​ to check equality) ​is used to compare two different values on each side of the operator ​(i.e. the left operand and right operand). Refer to the table below for a list of all operators currently supported.
  
-^Operator^Evaluates ​to true when:^+^Operator^Expression evaluates ​to true when:^
 |==|Left operand is **equal to** the right operand.| |==|Left operand is **equal to** the right operand.|
 |!=|Left operand is **not equal to** the right operand.| |!=|Left operand is **not equal to** the right operand.|
Line 12: Line 12:
 |> =|Left operand is **greater than or equal to** the right operand.| |> =|Left operand is **greater than or equal to** the right operand.|
 |contains|Left operand **contains one or more of** the right operand.| |contains|Left operand **contains one or more of** the right operand.|
 +
 +====Examples:​====
 +<code lua>
 +self.property["​visited"​] == true
 +</​code>​
 +<code lua>
 +global.property["​gems_collected"​] >= 5
 +</​code>​
 +<code lua>
 +player.inventory contains "Gold Key"
 +</​code>​
 +
conditional_expression.txt ยท Last modified: 2017/08/06 12:45 by justin