mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-02-10 20:50:03 +00:00
cosmoV_register now uses the stack to pass params
This commit is contained in:
12
src/main.c
12
src/main.c
@@ -52,9 +52,13 @@ static void repl() {
|
||||
cosmoB_loadLibrary(state);
|
||||
cosmoB_loadDebug(state);
|
||||
|
||||
// TODO: there's gotta be a better way to do this
|
||||
cosmoV_register(state, "quit", cosmoV_newObj(cosmoO_newCFunction(state, cosmoB_quitRepl)));
|
||||
cosmoV_register(state, "input", cosmoV_newObj(cosmoO_newCFunction(state, cosmoB_input)));
|
||||
cosmoV_pushString(state, "quit");
|
||||
cosmoV_pushCFunction(state, cosmoB_quitRepl);
|
||||
|
||||
cosmoV_pushString(state, "input");
|
||||
cosmoV_pushCFunction(state, cosmoB_input);
|
||||
|
||||
cosmoV_register(state, 2);
|
||||
|
||||
while (_ACTIVE) {
|
||||
printf("> ");
|
||||
@@ -107,8 +111,6 @@ static void runFile(const char* fileName) {
|
||||
CState *state = cosmoV_newState();
|
||||
cosmoB_loadLibrary(state);
|
||||
|
||||
cosmoV_register(state, "input", cosmoV_newObj(cosmoO_newCFunction(state, cosmoB_input)));
|
||||
|
||||
interpret(state, script, fileName);
|
||||
|
||||
cosmoV_freeState(state);
|
||||
|
||||
Reference in New Issue
Block a user