diff options
| author | nic-gaffney <gaffney_nic@protonmail.com> | 2023-04-27 17:19:54 -0500 |
|---|---|---|
| committer | nic-gaffney <gaffney_nic@protonmail.com> | 2023-04-27 17:19:54 -0500 |
| commit | ac8c9abab30d66ff208a623d0a6de8869373a554 (patch) | |
| tree | 8d2d20d9a5312a1e2fad73d9a6ee7294b0c27dc2 /crates/sloth_vm/src/sloth_std/file.rs | |
| parent | 757e804671ef3dcb2e0f1295e385780b5feae2ca (diff) | |
| parent | af02ccd056754c60131d13d74b9fac0e23b2af31 (diff) | |
| download | sloth-ac8c9abab30d66ff208a623d0a6de8869373a554.tar.gz | |
Merge branch 'standard-library' of github.com-Nic:slothlang/sloth into standard-library
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/file.rs')
| -rw-r--r-- | crates/sloth_vm/src/sloth_std/file.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/sloth_vm/src/sloth_std/file.rs b/crates/sloth_vm/src/sloth_std/file.rs index b6c8adf..dea914a 100644 --- a/crates/sloth_vm/src/sloth_std/file.rs +++ b/crates/sloth_vm/src/sloth_std/file.rs @@ -31,6 +31,11 @@ pub const FILE_READ: NativeFunction = NativeFunction { function: file_read, arity: 1, returns_value: true, + doc: Some( + "NativeFunction file_read: \n\targs: path (str)\n\tdesc: Returns the contents of a file \ + at <path>\n\tExample: `var todo = file_read('/home/sloth/todo.txt'); # Assuming the \ + contents of todo.txt are 'Take a nap' then todo = 'Take a nap'`", + ), }; fn file_write(vm: &mut VM, args: &[Primitive]) -> NativeFunctionResult { @@ -70,4 +75,9 @@ pub const FILE_WRITE: NativeFunction = NativeFunction { function: file_write, arity: 2, returns_value: false, + doc: Some( + "NativeFunction file_write: \n\targs: path (str), content (str)\n\tdesc: Writes <content> \ + to file at <path>\n\tExample: `file_write('/home/sloth/todo.txt', 'Take a nap'); # \ + todo.txt now contains the string 'Take a nap'`", + ), }; |
