You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

panoyun

Beginner

  • "panoyun" started this thread

Posts: 31

Location: Somalia

  • Send private message

1

Friday, February 28th 2020, 12:10pm

array appears undefined

DEBUG: element=[arrayname0,arrayname1] length=2 type=array
DEBUG: element[arrayname0].attribute=undefined type=undefined

DEBUG: element[arrayname0].attribute1=value1 type=string



//<element arrayname="arrayname0" attribute="value" attribute1="value1"/>
//<element arrayname="arrayname1" attribute="value" attribute1="value1"/>


<action name="action_diwmwaubdqpe" autorun="onstart">
def(element, array);
def(element[0], string,'arrayname0');
def(element[1], string,'arrayname1');
def(element[arrayname0].attribute, string, 'value');
def(element[arrayname0].attribute1, string, 'value1');

debugvar(element);
debugvar(element[arrayname0].attribute);
debugvar(element[arrayname0].attribute1);

for(set(i,0),i LT element.length,inc(i) ,
set(element[get(i)], calc('arrayname' + i));

trace('length=',element.length);
trace('index=','element[',get(i),'].index','=',get(element[get(i)]));

trace('name=','element[',get(i),'].name','=',get(element[get(i)]));
trace('attribute=','element[',get(i),'].attribute','=',get(element[arrayname0].attribute));
trace('attribute=','element[',get(i),'].attribute1','=',get(element[arrayname0].attribute1));
);
</action>

2

Wednesday, March 4th 2020, 6:07pm

Hi,

what are you trying todo?
Some of your codes are not correct.

Please note that there are two types of Arrays in krpano - the 'xml arrays' and the 'value arrays' (which are more classic arrays).

Please see here for more information:
https://krpano.com/docu/actions/#arrays

Best regards,
Klaus

panoyun

Beginner

  • "panoyun" started this thread

Posts: 31

Location: Somalia

  • Send private message

3

Thursday, March 5th 2020, 3:32pm

I want to use
Value-Arrays
Create one dynamically
<element name = "arrayname0" attribute = "value" attribute1 = "value1" />
This is a static structure *tongue* *tongue*

4

Thursday, March 5th 2020, 4:05pm

Value-arrays can't be created by static xml code, only by actions.
When you define a xml element with a name it will be an entry of a xml-array.

panoyun

Beginner

  • "panoyun" started this thread

Posts: 31

Location: Somalia

  • Send private message

5

Friday, March 6th 2020, 6:08am

<action name="action_dsyrxfpbetum" autorun="onstart">
def(test, array);
set(test[0], i1);
set(test[1], i2);
set(test[2], i3);
debugvar(test);
for(set(i,0),i LT test.length,inc(i) ,
debugvar(test[get(i)]);
trace('array.length','=',get(test.length));
trace('test[',get(i),'].index','=',get(test[get(i)]));
);
</action>

Klaus
Value-Arrays
What is his use?
Can you write an example?
thank you
https://krpano.com/docu/actions/#valuearrays
*smile* *smile* *smile*

Similar threads