Hello
ndds 5.0.0.3 , RTI_Prototyper_with_lua
I am having an issue with accessing data types with Lua, and it mostly stems from not having a complete understanding of how the RTI prototyper-with-Lua handles data types
If I am making a simple string type in my XML file (USER_QOS_PROFILE)
------------------------------------------------------------------------
<const name= "MaxNameLength" type ="long" value ="64"/>
<struct name ="PhoneCall" >
<member name ="Caller" type ="string" key ="true" stringMaxLength= "MaxNameLength"/>
</struct>
-------------------------------------------------------------------------
I know I can acces the data in the following:
On the publisher side -
CONTAINER.WRITER['MyPublisher::Caller'].instance['caller'] = 'me'
On the subscriber side -
print('Name is - ' .. CONTAINER.READER['MySubscriber::Receiver']['sample'][1]['Caller'] )
My question is how do I access the data if I have this data type
<typedef name="MODULE_TYPE" type="long" arrayDimensions="2"/>
<struct name="Detector">
<member name="Detector_member" type="nonBasic" nonBasicTypeName="MODULE_TYPE" arrayDimensions="52"/>
</struct>
I am trying
print(CONTAINER.READER['MySubscriber::Receiver'].sample[1]['Detector_member']), but I am getting an error.
-----------------------ERROR-----------------------------------
RTILuaDynamicData_get:!get kind failed for 'valid_data'
valid_data: nil
^CFinishing Prototyper...
-----------------------ERROR----------------------------------
Can anyone tell me what I am doing wrong, and if possible point me to references so I can better understand how my XML types are being processed in order to be accessed througth Lua
I currently have the getting started pdf https://s3.amazonaws.com/RTI/RTI_BUNDLES/experimental/rti_prototyper_with_lua/RTI_Connext_Prototyper_GettingStarted.pdf
Hello Ken,
Unfortunately I think you hit a bug.
The bug has been filed and it’s number is CORE-6307
The type you are trying to use is an array of an array:
The correct way to access that in Lua would be:
Unfortunately that is not working doing to the bug previously mentioned.
There is a work around: if you have to use an array of an array, you could create a struct instead of a typedef:
In lua you can now access the data this way:
I hope this will help you until the bug is fixed. I would like to understand how critical is this for you so we can better prioritize. Please let me know.
As far as it goes for documentation, in section 6.4 ‘Data Access API’, of the Getting Started we describe how to access complex types: see the examples in section 6.4.1
We are working on a better way to access data than just using strings. Hopefully that will lead to a better, more clear way to do it as well as more clear documentation.
Please let me know if I can support you in any other way.
Best Regards,
Gianpiero Napoli
Can I get a time frame of when this bug will be fixed ? if not at least a status update on it, such as its priority level ?
my project invovles incorporating the Lua Prototyper to already existing code, with predefined data types, due to this bug I might have to look for alternative means to incorporate scripting with DDS.
Hello Ken,
support can definetely help you with that. I would suggest you send an email to support@rti.com referencing this post and including your contact information. I am sure they will know more than I do about priority and time frame.
Let me know if there is something else I can do to help,
Regards,
Gianpiero Napoli
Anybody know if this hack will work with a sequence of arrays, as opposed to an array of arrays?
Hello,
I did not try but I think it should.
Best,
Gianpiero