This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:5.3.x:pseudovariables [2020/02/21 17:13] btriller |
cookbooks:5.3.x:pseudovariables [2020/04/02 21:32] miconda [$xavp(id) - XAVPs] |
||
---|---|---|---|
Line 722: | Line 722: | ||
===== $xavp(id) - XAVPs ===== | ===== $xavp(id) - XAVPs ===== | ||
- | xavp - extended AVP' | + | **xavp** - eXtended AVPs - are variables |
+ | |||
+ | They work like a stack, | ||
+ | |||
+ | Each xavp has a string | ||
+ | |||
+ | To assign a single | ||
<code c> | <code c> | ||
- | $xavp(root=> | + | $xavp(root)=" |
+ | $xavp(root)=intnumber; | ||
+ | </code> | ||
+ | |||
+ | To assign a named value use: | ||
+ | |||
+ | <code c> | ||
+ | $xavp(root=> | ||
+ | $xavp(root=> | ||
</ | </ | ||
Like avps, xavp act like a stack. To refer to an existing value, use an index. The newest xavp has index zero [0]. | Like avps, xavp act like a stack. To refer to an existing value, use an index. The newest xavp has index zero [0]. | ||
+ | |||
<code c> | <code c> | ||
- | $xavp(root[0]=> | + | $xavp(root[0]=> |
</ | </ | ||
If you assign a value without an index, a new xavp is allocated and the old one is pushed up the stack, becoming index [1]. Old index [1] becomes [2] etc. | If you assign a value without an index, a new xavp is allocated and the old one is pushed up the stack, becoming index [1]. Old index [1] becomes [2] etc. | ||
+ | |||
<code c> | <code c> | ||
+ | # new item (example => (name = " | ||
$xavp(example=> | $xavp(example=> | ||
- | #create | + | # add new item (example => (name = " |
$xavp(example=> | $xavp(example=> | ||
- | #add extra value to " | + | # add another named value to the last example item |
$xavp(example[0]=> | $xavp(example[0]=> | ||
- | #add value to first variable - " | + | # add another named value to first example item |
- | $xavp(example[1]=> | + | xavp(example[1]=> |
</ | </ | ||