rule of three
June 24th, 2009, 21:40
Hi. I've some problems with database associated with listitems.
I will take the example of the weaponlist :
---------------------------------------------------------------------
<charsheet>
<id-00001> (player's character 1)
...
<weaponlist>
<holder name="RV" owner="true" />
<id-00001>
<holder name="RV" owner="true" />
<ammo type="number">0</ammo>
...
<damagedice type="dice"></damagedice>
<name type="string">arme A</name>
...
</id-00001>
<id-00002>
...
</id-00002></weaponlist>
</id-00001>
------------------------------------------------------------------
I can access to the datanode of the player (id-01 for example) with :
local node = window.getDatabaseNode();
print (node.getNodeName()) gives "charsheet.id-0001"
I get the good number of child when I use :
local weaponnumber = node.getChild("weaponlist").getChildCount();
print (weaponnumber()) gives "2"
And I seem to get the good table with :
local weaponstable = node.getChild("weaponlist").getChildren();
My problem is that I don't find how to access to the name or damagedice of the differents weapons !
table[1].name.getValue() doesn't work for example. It would be to easy.
for k, v in ipairs (table) doesn't work neither : the windowlist isn't open.
Can somebody help me ?
I will take the example of the weaponlist :
---------------------------------------------------------------------
<charsheet>
<id-00001> (player's character 1)
...
<weaponlist>
<holder name="RV" owner="true" />
<id-00001>
<holder name="RV" owner="true" />
<ammo type="number">0</ammo>
...
<damagedice type="dice"></damagedice>
<name type="string">arme A</name>
...
</id-00001>
<id-00002>
...
</id-00002></weaponlist>
</id-00001>
------------------------------------------------------------------
I can access to the datanode of the player (id-01 for example) with :
local node = window.getDatabaseNode();
print (node.getNodeName()) gives "charsheet.id-0001"
I get the good number of child when I use :
local weaponnumber = node.getChild("weaponlist").getChildCount();
print (weaponnumber()) gives "2"
And I seem to get the good table with :
local weaponstable = node.getChild("weaponlist").getChildren();
My problem is that I don't find how to access to the name or damagedice of the differents weapons !
table[1].name.getValue() doesn't work for example. It would be to easy.
for k, v in ipairs (table) doesn't work neither : the windowlist isn't open.
Can somebody help me ?