diff --git a/docs/stdlib.md b/docs/stdlib.md index e349b35..3811616 100644 --- a/docs/stdlib.md +++ b/docs/stdlib.md @@ -59,7 +59,12 @@ Includes functions that interact with the operating system. | Name | Type | Behavior | Example | | ------------ | ------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------ | -| os.read | `(path)` -> `` or `` | Returns a file's contents or nil if it doesn't exist/an error occurred | `os.read("path")` -> `Hello, World!`| +| os.open | `(path)` -> `, ` | Opens a file at `path` and returns a file object. If the file does not exist, it will be created. | `os.open("test.txt")` -> `true, ` | | os.time | `()` -> `` | Returns the system time in Epoch format | `os.time()` -> `1.61691e+09` | | os.system | `(cmd)` -> `` | Runs a system command as if it were a terminal and returns the exit code | `os.system("mkdir test")` -> `0` | -> -> means 'returns' \ No newline at end of file +> -> means 'returns' + +File objects have the following methods: +| Name | Type | Behavior | Example | +| ------------ | ------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------ | +| file:read | `(amt or "a")` -> `` | Reads `amt` bytes from the file and returns them as a string. If `"a"` is passed, the entire file is read. | `file:read("a")` -> `"Hello world!"` | \ No newline at end of file