Added optional os.* library, fixed cosmoB_loadLibrary

- os.time() returns the UNIX Epoch time in seconds
- os.read() reads file and returns the data as a <string> object
This commit is contained in:
2021-02-10 17:10:03 -06:00
parent 7db0782991
commit cfb4df66f9
3 changed files with 90 additions and 3 deletions

View File

@@ -52,6 +52,7 @@ static void repl() {
CState *state = cosmoV_newState();
cosmoB_loadLibrary(state);
cosmoB_loadOSLib(state);
cosmoB_loadVM(state);
// add our custom REPL functions
@@ -113,6 +114,7 @@ static void runFile(const char* fileName) {
char* script = readFile(fileName);
CState *state = cosmoV_newState();
cosmoB_loadLibrary(state);
cosmoB_loadOSLib(state);
// add our input() function to the global table
cosmoV_pushString(state, "input");