libtbag/script/LuaMain.cpp
// JIT engine control command: try jit library first or load add-on module.
JIT engine control command: try jit library first or load add-on module.
JIT engine control command : try jit library first or load add - on module .
static int do_jit_cmd(lua_State * L, char const * cmd)
{
    char const * opt = strchr(cmd, '=');
    lua_pushlstring(L, cmd, opt ? (size_t)(opt - cmd) : strlen(cmd));
    lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
    lua_getfield(L, -1, "jit"); 
    lua_remove(L, -2);
    lua_pushvalue(L, -2);
    lua_gettable(L, -2); 
    if (!lua_isfunction(L, -1)) {
        lua_pop(L, 2); 
        if (load_jit_module(L)) {
            return 1;
        }
    } else {
        lua_remove(L, -2); 
    }
    lua_remove(L, -2); 
    return run_command_with_options(L, opt ? opt+1 : opt);
}
static int do_jit_cmd ( lua_State * L , char const * cmd ) { char const * opt = strchr ( cmd , ' ' ) ; lua_pushlstring ( L , cmd , opt ? ( size_t ) ( opt - cmd ) : strlen ( cmd ) ) ; lua_getfield ( L , LUA_REGISTRYINDEX , " " ) ; lua_getfield ( L , -1 , " " ) ; lua_remove ( L , -2 ) ; lua_pushvalue ( L , -2 ) ; lua_gettable ( L , -2 ) ; if ( ! lua_isfunction ( L , -1 ) ) { lua_pop ( L , 2 ) ; if ( load_jit_module ( L ) ) { return 1 ; } } else { lua_remove ( L , -2 ) ; } lua_remove ( L , -2 ) ; return run_command_with_options ( L , opt ? opt + 1 : opt ) ; }
JIT engine control command: try jit library first or load add-on module.
JIT engine control command : try jit library first or load add - on module .
// Get jit.* module table. // Lookup library function. // Drop non-function and jit.* table, keep module name. // Drop jit.* table. // Drop module name.