Fix sleep function.

This commit is contained in:
Stephen Chung 2022-03-09 09:41:53 +08:00
parent 1e4abd012c
commit 963af0653e

View File

@ -82,7 +82,8 @@ mod core_functions {
/// Block the current thread for a particular number of `seconds`. /// Block the current thread for a particular number of `seconds`.
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
#[rhai_fn(name = "float")] #[cfg(not(feature = "no_std"))]
#[rhai_fn(name = "sleep")]
pub fn sleep_float(seconds: FLOAT) { pub fn sleep_float(seconds: FLOAT) {
if seconds <= 0.0 { if seconds <= 0.0 {
return; return;
@ -95,6 +96,7 @@ mod core_functions {
} }
/// Block the current thread for a particular number of `seconds`. /// Block the current thread for a particular number of `seconds`.
#[cfg(not(feature = "no_std"))]
pub fn sleep(seconds: INT) { pub fn sleep(seconds: INT) {
if seconds <= 0 { if seconds <= 0 {
return; return;