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:
2023-09-05 14:38:24 -05:00
committed by cpunch
parent bf36412699
commit b3587f48a2
3 changed files with 152 additions and 42 deletions

View File

@@ -3,6 +3,13 @@
#include "cstate.h"
enum
{
COSMO_USER_NONE, // CObjObject is not a userdata object
COSMO_USER_FILE, // CObjObject is a file object (see cosmoB_osOpen)
COSMO_USER_START // the first user type for user-defined userdata
};
/* loads all of the base library, including:
- base library ("print", "assert", "type", "pcall", "loadstring", etc.)
- object library