** Interface to 'lua_pcall', which sets appropriate message function ** and C-signal handler. Used to run all chunks. */
| 129 | ** and C-signal handler. Used to run all chunks. |
| 130 | */ |
| 131 | static int docall (lua_State *L, int narg, int nres) { |
| 132 | int status; |
| 133 | int base = lua_gettop(L) - narg; /* function index */ |
| 134 | lua_pushcfunction(L, msghandler); /* push message handler */ |
| 135 | lua_insert(L, base); /* put it under function and args */ |
| 136 | globalL = L; /* to be available to 'laction' */ |
| 137 | signal(SIGINT, laction); /* set C-signal handler */ |
| 138 | status = lua_pcall(L, narg, nres, base); |
| 139 | signal(SIGINT, SIG_DFL); /* reset C-signal handler */ |
| 140 | lua_remove(L, base); /* remove message handler from the stack */ |
| 141 | return status; |
| 142 | } |
| 143 | |
| 144 | |
| 145 | static void print_version (void) { |
no test coverage detected