User Tools

Site Tools


string

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
string [2017/06/01 08:58] justinstring [2021/04/21 20:07] (current) justin
Line 5: Line 5:
  
 ====Example:==== ====Example:====
-<code lua+<code bauxite
-display_message("Hello world! This is a string.")+display_message("Helloworld! This is a string.");
 </code> </code>
  
Line 12: Line 12:
  
 <WRAP center round info 100%> <WRAP center round info 100%>
-Any double quotation marks within a string (excluding the enclosing quotation marks) must be escaped with a preceding backslash.+**Note:** Any double quotation marks within a string (excluding the quotation marks used to enclose it) must be escaped with a preceding backslash.
 </WRAP> </WRAP>
  
 ====Example:==== ====Example:====
-<code lua+<code bauxite
-set_entity_property(entity["sign_01"], "message", "This is the sign's message text.")+set_entity_property(entity["sign_01"], "message", "The sign'\"message\".");
 </code> </code>
  
-The above example demonstrates 3 different cases of a string being used: an entity name reference, the name of the property, and a text value to store in the property.+The above example demonstrates 3 different cases of a string being used: an entity by ID reference, the name of the property, and a text value to store in the property. 
 + 
 +=====String Concatenation===== 
 +Strings can be concatenated, or connected together, using the plus symbol between two or more values. These values can be either a literal string (e.g. "Hello!"), variable name (e.g. my_string), or a reference to a property (e.g. global.property["my_string"]). The assumption is made that the variable or property contains a valid string value. This syntax can be used in most places where a string value is expected. 
 + 
 +====Example:==== 
 +<code bauxite> 
 +display_message("Hello, " + global.property["player_name"] + "!"); 
 +</code>
  
 ~~NOTOC~~ ~~NOTOC~~
string.1496332735.txt.gz · Last modified: 2017/06/01 08:58 by justin