| Quintiq file version 2.0 | 
| #parent: #root | 
| Method ReadLast (const LibOpt_Task task, Number number_of_messages) const as owning Strings | 
| { | 
|   Description: 'Read the last N messages from the channel. If there are fewer than N messages, only the available messages are returned.' | 
|   TextBody: | 
|   [* | 
|     id := this.Channel().GetAlgorithmStoreID( task, false ); | 
|     algorithm := this.Channel().GetAlgorithm( id ); | 
|      | 
|     count := RealToNumber::ISOConverter().Convert( algorithm.RetrieveReal( LibOpt_Channel::Algorithm_Count() ) ); | 
|     result := construct( Strings ); | 
|     for( i := maxvalue( 0, count - number_of_messages ); i < count; i++ ) | 
|     { | 
|       result.Add( algorithm.RetrieveString( LibOpt_Channel::Algorithm_Index( i ) ) ); | 
|     } | 
|      | 
|     AlgorithmStore::Store( id, & algorithm ); | 
|      | 
|     return & result; | 
|   *] | 
| } |