mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-05 17:29:43 +08:00
Add "console" object to mujs shell.
This commit is contained in:
5
main.c
5
main.c
@@ -230,6 +230,10 @@ static const char *stacktrace_js =
|
||||
"};\n"
|
||||
;
|
||||
|
||||
static const char *console_js =
|
||||
"var console = { log: print, debug: print, warn: print, error: print };"
|
||||
;
|
||||
|
||||
static int eval_print(js_State *J, const char *source)
|
||||
{
|
||||
if (js_ploadstring(J, "[stdin]", source)) {
|
||||
@@ -337,6 +341,7 @@ main(int argc, char **argv)
|
||||
|
||||
js_dostring(J, require_js);
|
||||
js_dostring(J, stacktrace_js);
|
||||
js_dostring(J, console_js);
|
||||
|
||||
if (xoptind == argc) {
|
||||
interactive = 1;
|
||||
|
||||
Reference in New Issue
Block a user