Commit aedac154 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Expose duration, end active, and end time fields in Lua runtime tournament listings.

parent 0d2d2b06
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Added
- Lua runtime tournament listings now return duration, end active, and end time fields.

### Changed
- Rejoining a match the user is already part of will now return the match label.

+8 −1
Original line number Diff line number Diff line
@@ -4114,7 +4114,7 @@ func (n *RuntimeLuaNakamaModule) tournamentList(l *lua.LState) int {

	tournaments := l.CreateTable(len(list.Tournaments), 0)
	for i, t := range list.Tournaments {
		tt := l.CreateTable(0, 13)
		tt := l.CreateTable(0, 16)

		tt.RawSetString("id", lua.LString(t.Id))
		tt.RawSetString("title", lua.LString(t.Title))
@@ -4128,6 +4128,8 @@ func (n *RuntimeLuaNakamaModule) tournamentList(l *lua.LState) int {
		tt.RawSetString("size", lua.LNumber(t.Size))
		tt.RawSetString("max_size", lua.LNumber(t.MaxSize))
		tt.RawSetString("max_num_score", lua.LNumber(t.MaxNumScore))
		tt.RawSetString("duration", lua.LNumber(t.Duration))
		tt.RawSetString("end_active", lua.LNumber(t.EndActive))
		tt.RawSetString("can_enter", lua.LBool(t.CanEnter))
		tt.RawSetString("next_reset", lua.LNumber(t.NextReset))
		metadataMap := make(map[string]interface{})
@@ -4140,6 +4142,11 @@ func (n *RuntimeLuaNakamaModule) tournamentList(l *lua.LState) int {
		tt.RawSetString("metadata", metadataTable)
		tt.RawSetString("create_time", lua.LNumber(t.CreateTime.Seconds))
		tt.RawSetString("start_time", lua.LNumber(t.StartTime.Seconds))
		if t.EndTime == nil {
			tt.RawSetString("end_time", lua.LNil)
		} else {
			tt.RawSetString("end_time", lua.LNumber(t.EndTime.Seconds))
		}

		tournaments.RawSetInt(i+1, tt)
	}