From af02ccd056754c60131d13d74b9fac0e23b2af31 Mon Sep 17 00:00:00 2001 From: nic-gaffney Date: Tue, 18 Apr 2023 10:42:45 -0500 Subject: Added more documentation in the native functions --- crates/sloth_vm/src/sloth_std/rand.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'crates/sloth_vm/src/sloth_std/rand.rs') diff --git a/crates/sloth_vm/src/sloth_std/rand.rs b/crates/sloth_vm/src/sloth_std/rand.rs index 93da0d7..1718c6d 100644 --- a/crates/sloth_vm/src/sloth_std/rand.rs +++ b/crates/sloth_vm/src/sloth_std/rand.rs @@ -16,7 +16,10 @@ pub const GEN_FUNCTION: NativeFunction = NativeFunction { function: gen, arity: 0, returns_value: true, - doc: None, + doc: Some( + "NativeFunction rand_gen:\n\tdesc: Returns a random number in the range `0.0 .. \ + 1.0`\n\tExample: `var num = rand_gen(); # num could be any number from 0.0 to 1.0`", + ), }; fn gen_range(_vm: &mut VM, args: &[Primitive]) -> NativeFunctionResult { @@ -37,5 +40,9 @@ pub const GEN_RANGE_FUNCTION: NativeFunction = NativeFunction { function: gen_range, arity: 2, returns_value: true, - doc: None, + doc: Some( + "NativeFunction rand_gen_range: \n\targs: min (int), max (int)\n\tdesc: Returns a random \ + numnber in the range .. \n\tExample: `var num = gen_range(20, 76); # num \ + could be any number from 20 to 76`", + ), }; -- cgit v1.2.3