** Interface to 'lua_pcall', which sets appropriate message function ** and C-signal handler. Used to run all chunks. */
| 196 | ** and C-signal handler. Used to run all chunks. |
| 197 | */ |
| 198 | static int docall (lua_State *L, int narg, int nres) { |
| 199 | int status; |
| 200 | int base = lua_gettop(L) - narg; /* function index */ |
| 201 | lua_pushcfunction(L, msghandler); /* push message handler */ |
| 202 | lua_insert(L, base); /* put it under function and args */ |
| 203 | globalL = L; /* to be available to 'laction' */ |
| 204 | signal(SIGINT, laction); /* set C-signal handler */ |
| 205 | status = lua_pcall(L, narg, nres, base); |
| 206 | signal(SIGINT, SIG_DFL); /* reset C-signal handler */ |
| 207 | lua_remove(L, base); /* remove message handler from the stack */ |
| 208 | return status; |
| 209 | } |
| 210 | |
| 211 | |
| 212 | static void print_version (void) { |
no test coverage detected