Added cosmoV_pushFString(), and cosmoO_pushVFString().

cosmoV_error now pushes the error string onto the stack, as well as uses cosmoO_VFString to format strings.
cosmoV_concat is now entirely self contained, and is now stack based. Push the CValues you want to concat into strings onto the stack and call cosmoV_concat with the # of values you pushed.
This commit is contained in:
2020-12-22 15:13:11 -06:00
parent de3a89ad4f
commit 31a852a127
5 changed files with 92 additions and 28 deletions

View File

@@ -52,6 +52,7 @@ static void repl() {
cosmoB_loadLibrary(state);
cosmoB_loadDebug(state);
// add our custom REPL functions
cosmoV_pushString(state, "quit");
cosmoV_pushCFunction(state, cosmoB_quitRepl);
@@ -111,6 +112,12 @@ static void runFile(const char* fileName) {
CState *state = cosmoV_newState();
cosmoB_loadLibrary(state);
// add our input() function to the global table
cosmoV_pushString(state, "input");
cosmoV_pushCFunction(state, cosmoB_input);
cosmoV_register(state, 1);
interpret(state, script, fileName);
cosmoV_freeState(state);