From a751222c697f8170a4a3931b3edb84437a2b9034 Mon Sep 17 00:00:00 2001 From: Simon Esposito Date: Mon, 21 Oct 2024 18:28:27 +0100 Subject: [PATCH] Fix Go runtime tournament listing params Allow -1 value on start and end time to return all active and upcoming tournaments. --- server/runtime_go_nakama.go | 8 ++++---- server/runtime_lua_nakama.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/runtime_go_nakama.go b/server/runtime_go_nakama.go index 17a08e9de..fed2c475c 100644 --- a/server/runtime_go_nakama.go +++ b/server/runtime_go_nakama.go @@ -2846,11 +2846,11 @@ func (n *RuntimeGoNakamaModule) TournamentList(ctx context.Context, categoryStar if categoryEnd < 0 || categoryEnd >= 128 { return nil, errors.New("categoryEnd must be 0-127") } - if startTime < 0 { - return nil, errors.New("startTime must be >= 0") + if startTime < -1 { + return nil, errors.New("startTime must be >= -1") } - if endTime < 0 { - return nil, errors.New("endTime must be >= 0") + if endTime < -1 { + return nil, errors.New("endTime must be >= -1") } if endTime < startTime { return nil, errors.New("endTime must be >= startTime") diff --git a/server/runtime_lua_nakama.go b/server/runtime_lua_nakama.go index c80c59533..72fdf4271 100644 --- a/server/runtime_lua_nakama.go +++ b/server/runtime_lua_nakama.go @@ -8333,24 +8333,24 @@ func (n *RuntimeLuaNakamaModule) tournamentList(l *lua.LState) int { startTime := -1 if v := l.Get(3); v.Type() != lua.LTNil { if v.Type() != lua.LTNumber { - l.ArgError(3, "startTime must be >= 0") + l.ArgError(3, "startTime must be >= -1") return 0 } startTime = int(lua.LVAsNumber(v)) if startTime < 0 { - l.ArgError(3, "startTime must be >= 0") + l.ArgError(3, "startTime must be >= -1") return 0 } } endTime := -1 if v := l.Get(4); v.Type() != lua.LTNil { if v.Type() != lua.LTNumber { - l.ArgError(4, "endTime must be >= 0") + l.ArgError(4, "endTime must be >= -1") return 0 } endTime = int(lua.LVAsNumber(v)) if endTime < 0 { - l.ArgError(4, "endTime must be >= 0") + l.ArgError(4, "endTime must be >= -1") return 0 } }