User Tools

Site Tools


placeholder_expression

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
placeholder_expression [2017/06/01 07:08] justinplaceholder_expression [2021/04/11 21:00] justin
Line 1: Line 1:
-======Placeholder Expressions======+======Placeholder Expression======
 ---- ----
  
-**placeholder expression** is scripting data type consisting of a string of characters enclosed by double quotes on each end. Strings are typically used to represent a message, for example in the [[Display Message]] functionor when referencing an entity name or property name within script. [[Placeholder expressions]] can be used within a string as a way to generate dynamic values at game runtime.+**Placeholder expressions** provide way to insert dynamic values into [[string|strings]] that will get evaluated at game runtime for displaying to the player or printing to the [[developer console]]. Generallyany sort of expression that can be stored into variable can also be used in a placeholder expression. 
 + 
 +<WRAP center round info 100%> 
 +Since placeholder expressions are parsed during a [[script|script's]] execution, they should be used sparingly to avoid potential slowdowns or hesitations. When possible, it's best to first store the expression into variable and then use [[string|string concatenation]] to generate the desired [[string]]. 
 +</WRAP> 
 + 
 +In regards to usage, the expression must be enclosed using the following syntax consisting of a dollar sign and curly braces: 
 + 
 +<code bauxite> 
 +${expression} 
 +</code> 
 + 
 +As with [[string|strings]], any double quotation marks in the placeholder expression must be escaped with backslashes.
  
 ====Example:==== ====Example:====
-<code lua+<code bauxite
-display_message("Hello world! This is a string. ${global.property[\"test\"]}")+display_message("The value of property ABC is ${global.property[\"ABC\"]}")
 </code> </code>
  
 ~~NOTOC~~ ~~NOTOC~~
placeholder_expression.txt · Last modified: 2021/04/21 20:23 by justin