** Interface to 'lua_pcall', which sets appropriate message function ** and C-signal handler. Used to run all chunks. */
| 152 | ** and C-signal handler. Used to run all chunks. |
| 153 | */ |
| 154 | static int docall (lua_State *L, int narg, int nres) { |
| 155 | int status; |
| 156 | int base = lua_gettop(L) - narg; /* function index */ |
| 157 | lua_pushcfunction(L, msghandler); /* push message handler */ |
| 158 | lua_insert(L, base); /* put it under function and args */ |
| 159 | globalL = L; /* to be available to 'laction' */ |
| 160 | setsignal(SIGINT, laction); /* set C-signal handler */ |
| 161 | status = lua_pcall(L, narg, nres, base); |
| 162 | setsignal(SIGINT, SIG_DFL); /* reset C-signal handler */ |
| 163 | lua_remove(L, base); /* remove message handler from the stack */ |
| 164 | return status; |
| 165 | } |
| 166 | |
| 167 | |
| 168 | static void print_version (void) { |
no test coverage detected