Skip to content

Commit

Permalink
Fix Go runtime tournament listing params (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito authored Oct 21, 2024
1 parent 8b0e9b9 commit 8ea2c95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions server/runtime_go_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -2848,11 +2848,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")
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 8ea2c95

Please sign in to comment.