mirror of
https://github.com/CPunch/Cosmo.git
synced 2025-12-31 21:20:07 +00:00
added os.open(); new file object
eg.
```lua
local err, file = os.open("LICENSE.md")
if err then
// do error handling stuff
end
// passing "a" to read() will read the whole file
print(file:read("a"))
```
This commit is contained in:
9
examples/reader.cosmo
Normal file
9
examples/reader.cosmo
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
local err, file = os.open("LICENSE.md")
|
||||
print("made file")
|
||||
if err then
|
||||
print("failed to open file")
|
||||
end
|
||||
|
||||
print(file)
|
||||
print(file:read("a"))
|
||||
Reference in New Issue
Block a user