|
Urit Novice
Joined: 23 Jun 2005 Posts: 32
|
Posted: Sat Nov 06, 2010 11:45 pm
[3.31 Pro] Scope bug with #forall and events raising events |
Bug summary:
Forall in an event raised from another event proceeds down a scope level instead of resetting. That is, in event 1, #forall's items are %i, but when raising event 2 from event 1, #forall's items are %j rather than resetting to %i.
Take the following code and paste it into a new session:
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="testalias1" copy="yes">
<value>#forall $items1 {testalias2 %db( @testvar, %i)}</value>
<arglist>$items1</arglist>
</alias>
<alias name="testalias2" copy="yes">
<value>#forall $items2 {#echo %i}</value>
<arglist>items2</arglist>
</alias>
<alias name="testcalleevent" copy="yes">
<value>#forall $items1 {#raiseevent testevent2 %db( @testvar, %i)}</value>
</alias>
<var name="testvar" type="Record" copy="yes">
<json>{"test2":[4,5,6],"test1":[1,2,3]}</json>
</var>
<event event="testevent1" priority="62930" copy="yes">
<value>#forall $items1 {#raiseevent testevent2 %db( @testvar, %i)}</value>
<arglist>$items1</arglist>
</event>
<event event="testevent2" priority="62940" copy="yes">
<value>#forall $items2 {#echo %i}</value>
<arglist>$items2</arglist>
</event>
</cmud> |
Now, raise event testevent1 with arguments being one or more of the keys of the db variable "testvar"
Command:
#raiseevent testevent1 test1
Output expected:
1
2
3
Output actual:
test1
test1
test1
Command:
#raiseevent testevent1 test1|test2
Output expected:
1
2
3
4
5
6
Output actual:
test1
test1
test1
test2
test2
test2
Now let's prove this is just a problem with events raising events.
Command:
testalias1 test1
Output expected:
1
2
3
Output actual:
1
2
3
That works. Let's call an event from an alias:
Command:
testcalleevent test1
Output expected:
1
2
3
Output actual:
1
2
3 |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 08, 2010 5:55 pm |
Confirmed and added to bug list.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|