This topic contains 2 replies, has 3 voices, and was last updated by lev 9 years, 9 months ago.
iguana.messageId() function
You must be logged in to reply to this topic.
This topic contains 2 replies, has 3 voices, and was last updated by lev 9 years, 9 months ago.
I’d like to log the internal message id with an iguana.logInfo() call to aid in troubleshooting but I’m having trouble capturing the value as a string. Whenever I try to store the value:
str = iguana.messageId()
it winds up as nil. I’ve also tried iguana.messageId():S() which errors with an attempt to index a nil value. tostring(iguana.messageId()) also returns nil. What am I doing wrong?
When working inside the Translator (i.e. a testing context, not a running channel), iguana.messageId() returns nil because there’s no real message being processed. Are you sure you see the same thing happening if the channel is run?
It would be right to send such question to support@interfaceware.com.
Check carefully documentation for this function in our Wiki:
Note: the return value can be converted to a string using tostring() but its internal value cannot be changed.
Returns:
Either message ID object message_id.
Or nil if the message has not been placed in the queue nil.
In other words, while running in IDE function returns nil because test message is not pushed into Iguana queue.
It takes to run script with real channel to have message to make it into Iguana queue.
Create simple project:
function main(Data) print('printing messageId 1st time') print(iguana.messageId()) print('printing messageId 2nd time') print(iguana.messageId()) end
Run it in IDE and see print() returns nil
Run it in Filter script of channel “From LLP Listener to Channel” or “From LLP CLient to Translator” and you will see in Iguana logs messageId value printed.
Make sure you run latest version. This feature didn’t exist in early versions of Iguana.
You must be logged in to reply to this topic.