Use new looping tags to implement loop macros
This commit is contained in:
parent
dd0b2104a5
commit
9fb175c9d6
1 changed files with 7 additions and 24 deletions
|
@ -211,24 +211,16 @@
|
|||
# wmlindent: start ignoring
|
||||
#define FOREACH ARRAY_VALUE VAR
|
||||
# Macro to begin a WML clause that iterates over an array.
|
||||
{VARIABLE {VAR} 0}
|
||||
[while]
|
||||
[variable]
|
||||
name={VAR}
|
||||
less_than=${ARRAY_VALUE}.length
|
||||
[/variable]
|
||||
[for]
|
||||
array={ARRAY_VALUE}
|
||||
variable={VAR}
|
||||
[do]
|
||||
#enddef
|
||||
|
||||
#define NEXT VAR
|
||||
# Macro to end a WML clause that iterates over an array.
|
||||
[set_variable]
|
||||
name={VAR}
|
||||
add=1
|
||||
[/set_variable]
|
||||
[/do]
|
||||
[/while]
|
||||
{CLEAR_VARIABLE {VAR}}
|
||||
[/for]
|
||||
#enddef
|
||||
# wmlindent: stop ignoring
|
||||
|
||||
|
@ -242,22 +234,13 @@
|
|||
#! {REPEAT 5 (
|
||||
#! {QUAKE "rumble.ogg"}
|
||||
#! )}
|
||||
{VARIABLE REPEAT_i 0}
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name=REPEAT_i
|
||||
less_than={NUMBER}
|
||||
[/variable]
|
||||
|
||||
[repeat]
|
||||
times={NUMBER}
|
||||
[do]
|
||||
{BODY_WML}
|
||||
|
||||
{VARIABLE_OP REPEAT_i add 1}
|
||||
[/do]
|
||||
[/while]
|
||||
|
||||
{CLEAR_VARIABLE REPEAT_i}
|
||||
[/repeat]
|
||||
#enddef
|
||||
|
||||
#define LOOKUP_INDEX FROM_ARRAY_NAME WHERE_KEY_NAME WHERE_VALUE SAVE_AS_NAME
|
||||
|
|
Loading…
Add table
Reference in a new issue