MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / docall

Function docall

src/Chain/libraries/glua/lrepl.cpp:81–93  ·  view source on GitHub ↗

** Interface to 'lua_pcall', which sets appropriate message function ** and C-signal handler. Used to run all chunks. */

Source from the content-addressed store, hash-verified

79** and C-signal handler. Used to run all chunks.
80*/
81static int docall(lua_State *L, int narg, int nres) {
82 int status;
83 int base = lua_gettop(L) - narg; /* function index */
84 lua_pushcfunction(L, msghandler); /* push message handler */
85 lua_insert(L, base); /* put it under function and args */
86 globalL = L; /* to be available to 'laction' */
87 signal(SIGINT, laction); /* set C-signal handler */
88 status = lua_pcall(L, narg, nres, base);
89 signal(SIGINT, SIG_DFL); /* reset C-signal handler */
90 if (lua_gettop(L) > 0)
91 lua_remove(L, base); /* remove message handler from the stack */
92 return status;
93}
94
95/*
96** Check whether 'status' is not OK and, if so, prints the error

Callers 4

dochunkFunction · 0.70
dolibraryFunction · 0.70
handle_scriptFunction · 0.70
luaL_doREPLFunction · 0.70

Calls 2

lua_gettopFunction · 0.85
signalClass · 0.50

Tested by

no test coverage detected