engine/crash/src/script_crash.cpp
/*# get all loaded modules from when the crash occured
     *
     * The function returns a table containing entries with sub-tables that
     * have fields 'name' and 'address' set for all loaded modules.
     *
     * @name crash.get_modules
     * @param handle [type:number] crash dump handle
     * @return modules [type:table] module table
     */
get all loaded modules from when the crash occured
The function returns a table containing entries with sub-tables that
have fields 'name' and 'address' set for all loaded modules.

@name crash.get_modules
@param handle [type:number] crash dump handle
@return modules [type:table] module table
get all loaded modules from when the crash occured The function returns a table containing entries with sub - tables that have fields ' name ' and ' address ' set for all loaded modules . @name crash . get_modules @param handle [ type : number ] crash dump handle @return modules [ type : table ] module table
static int Crash_GetModules(lua_State* L)
    {
        int top = lua_gettop(L);
        HDump h = CheckHandle(L, 1);
        lua_newtable(L);
        for (uint32_t i=0;true;i++)
        {
            void* addr = GetModuleAddr(h, i);
            const char* name = GetModuleName(h, i);
            assert((!addr && !name) || (addr && name));
            if (!addr)
            {
                break;
            }
            lua_pushnumber(L, i+1);
            lua_newtable(L);
            lua_pushstring(L, "name");
            lua_pushstring(L, name);
            lua_settable(L, -3);
            char str[64];
            sprintf(str, "%p", addr);
            lua_pushstring(L, "address");
            lua_pushstring(L, str);
            lua_settable(L, -3);
            lua_settable(L, -3);
        }
        assert(lua_gettop(L) == (top+1));
        return 1;
    }
static int Crash_GetModules ( lua_State * L ) { int top = lua_gettop ( L ) ; HDump h = CheckHandle ( L , 1 ) ; lua_newtable ( L ) ; for ( uint32_t i = 0 ; true ; i ++ ) { void * addr = GetModuleAddr ( h , i ) ; const char * name = GetModuleName ( h , i ) ; assert ( ( ! addr && ! name ) || ( addr && name ) ) ; if ( ! addr ) { break ; } lua_pushnumber ( L , i + 1 ) ; lua_newtable ( L ) ; lua_pushstring ( L , " " ) ; lua_pushstring ( L , name ) ; lua_settable ( L , -3 ) ; char str [ 64 ] ; sprintf ( str , " " , addr ) ; lua_pushstring ( L , " " ) ; lua_pushstring ( L , str ) ; lua_settable ( L , -3 ) ; lua_settable ( L , -3 ) ; } assert ( lua_gettop ( L ) == ( top + 1 ) ) ; return 1 ; }
get all loaded modules from when the crash occured
 The function returns a table containing entries with sub-tables that
 have fields 'name' and 'address' set for all loaded modules.
get all loaded modules from when the crash occured The function returns a table containing entries with sub - tables that have fields ' name ' and ' address ' set for all loaded modules .