Skip to content

Commit 7ae2c90

Browse files
authored
Merge pull request #61 from cloudwindy/patch-2
fix(time): allow time.sleep to sleep for milliseconds
2 parents 8d789fd + d704624 commit 7ae2c90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

time/api.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ func UnixNano(L *lua.LState) int {
2222

2323
// Sleep lua time.sleep(number) port of go time.Sleep(int64)
2424
func Sleep(L *lua.LState) int {
25-
val := L.CheckNumber(1)
26-
time.Sleep(time.Duration(val) * time.Second)
25+
val := float64(L.CheckNumber(1))
26+
sec := float64(time.Second)
27+
time.Sleep(time.Duration(val * sec))
2728
return 0
2829
}
2930

0 commit comments

Comments
 (0)