Load add-on module. */
| 296 | |
| 297 | /* Load add-on module. */ |
| 298 | static int loadjitmodule(lua_State *L) |
| 299 | { |
| 300 | lua_getglobal(L, "require"); |
| 301 | lua_pushliteral(L, "jit."); |
| 302 | lua_pushvalue(L, -3); |
| 303 | lua_concat(L, 2); |
| 304 | if (lua_pcall(L, 1, 1, 0)) { |
| 305 | const char *msg = lua_tostring(L, -1); |
| 306 | if (msg && !strncmp(msg, "module ", 7)) |
| 307 | goto nomodule; |
| 308 | return report(L, 1); |
| 309 | } |
| 310 | lua_getfield(L, -1, "start"); |
| 311 | if (lua_isnil(L, -1)) { |
| 312 | nomodule: |
| 313 | l_message(progname, |
| 314 | "unknown luaJIT command or jit.* modules not installed"); |
| 315 | return 1; |
| 316 | } |
| 317 | lua_remove(L, -2); /* Drop module table. */ |
| 318 | return 0; |
| 319 | } |
| 320 | |
| 321 | /* Run command with options. */ |
| 322 | static int runcmdopt(lua_State *L, const char *opt) |
no test coverage detected