Skip to content

Commit

Permalink
Fix Go runtime tournament listing params
Browse files Browse the repository at this point in the history
Allow -1 value on start and end time to return all active and upcoming
tournaments.
  • Loading branch information
sesposito committed Oct 21, 2024
1 parent 5a8ff0c commit c23fe83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/runtime_go_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -2846,10 +2846,10 @@ 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 {
if startTime < -1 {
return nil, errors.New("startTime must be >= 0")
}
if endTime < 0 {
if endTime < -1 {
return nil, errors.New("endTime must be >= 0")
}
if endTime < startTime {
Expand Down
8 changes: 4 additions & 4 deletions server/runtime_lua_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit c23fe83

Please sign in to comment.