Changes between Version 1 and Version 2 of GUI_-_Repeat
- Timestamp:
- Dec 10, 2014, 9:15:51 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GUI_-_Repeat
v1 v2 1 [[TOC]] 2 1 3 = Repeat = 2 4 The repeat object is designed to simplify cases where you have a large number of very similar objects nearby each other. 3 5 == Explanation == 4 6 The repeat object generates "count" copies of any objects nested within it. Since you can not have multiple copies of the same named object you insert "[n]" somewhere in the name. After parsing, the "n" is replaced with the index of the generated object in the repeat. 7 8 You can also specify the variable that is replaced as the value of the `var` attribute. This is useful if you need nested repeat objects. 5 9 6 10 '''Important:''' The repeat element does not automatically adjust child element sizing. … … 20 24 </repeat> 21 25 }}} 26 27 == Example - Nested == 28 For example, the following XML could be simplified by using a repeat element. 29 {{{ 30 #!xml 31 <object name="myObj[0][0]" type="sprite" sprite="mySprite"/> 32 <object name="myObj[0][1]" type="sprite" sprite="mySprite"/> 33 <object name="myObj[1][0]" type="sprite" sprite="mySprite"/> 34 <object name="myObj[1][1]" type="sprite" sprite="mySprite"/> 35 }}} 36 The next snippet uses the repeat element to create the same result. 37 {{{ 38 #!xml 39 <repeat count="2"> 40 <repeat count="2" var="m"> 41 <object name="myObj[n][m]" type="sprite" sprite="mySprite"/> 42 </repeat> 43 </repeat> 44 }}}