How come this works:
local something = v.body.components
but this doesn't:
local something = v.body.size_info
The former runs just fine, but the latter causes the script to bomb off with:
Cannot read field unit.T_body.size_info: not found.
Here's the definition from df.units.xml, with what I suppose to be the relevant lines indicated:
<compound name='body'>
<compound name='components' type-name='body_component_info'/> <-------------------------------
<stl-vector name='wounds'>
<pointer type-name='unit_wound'/>
</stl-vector>
<int32_t name='wound_next_id' init-value='1'/>
<static-array name='unk_39c' count='10'>
<int32_t init-value='-1'/>
</static-array>
<pointer name='body_plan' type-name='caste_body_info'/>
<int16_t name='weapon_bp' refers-to='$$._parent.body_plan.body_parts[$]' init-value='-1'/>
<static-array type-name='unit_attribute' name='physical_attrs'
count='6' index-enum='physical_attribute_type'/>
<compound name='size_info' type-name='body_size_info'/> <-------------------------------
<uint32_t name='blood_max'/>
<uint32_t name='blood_count'/>
<int32_t name='infection_level'
comment='GETS_INFECTIONS_FROM_ROT sets; DISEASE_RESISTANCE reduces; >=300 causes bleeding'/>
<stl-vector name='spatters'>
<pointer type-name='unit_spatter'/>
</stl-vector>
</compound>
I've stared at it until I'm crosseyed, and don't see any difference between the declarations, or any typos in my code. Does the ordering within 'body' require use of a different syntax in lua?
Thanks.