// Last returns the text of the last event of kind.
func (r *TurnEventRecorder) Last(kind string) string {
+ return r.LastEvent(kind).Text
+}
+
+// LastEvent returns the last event of kind.
+func (r *TurnEventRecorder) LastEvent(kind string) Event {
r.mutex.Lock()
defer r.mutex.Unlock()
for n := len(r.events) - 1; n >= 0; n-- {
if r.events[n].Kind == kind {
- return r.events[n].Text
+ return r.events[n]
}
}
- return ""
+ return Event{}
}
func (r *TurnEventRecorder) Add(event Event) {