Skip to content

Commit

Permalink
Merge pull request #61 from cloudwindy/patch-2
Browse files Browse the repository at this point in the history
fix(time): allow time.sleep to sleep for milliseconds
  • Loading branch information
scr-oath authored Sep 13, 2023
2 parents 8d789fd + d704624 commit 7ae2c90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions time/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ func UnixNano(L *lua.LState) int {

// Sleep lua time.sleep(number) port of go time.Sleep(int64)
func Sleep(L *lua.LState) int {
val := L.CheckNumber(1)
time.Sleep(time.Duration(val) * time.Second)
val := float64(L.CheckNumber(1))
sec := float64(time.Second)
time.Sleep(time.Duration(val * sec))
return 0
}

Expand Down

0 comments on commit 7ae2c90

Please sign in to comment.