function autoload_init(e) slotnumber = 99 -- load game data successful = 0 local file = assert(io.open("savegames\\gameslot" .. slotnumber .. ".dat", "r")) if file ~= nil then -- get game data strField = file:read() while strField ~= nil do -- get each data item optimised (0.01.09) if string.find(strField,"{}$") == nil and string.find(strField, "=") then -- crashes if {} ? and need = so skip strsub = string.match(strField,"%w-%[(%d%d-)%]") -- new approach (0.01.09) if strsub then i = tonumber(strsub) if (string.sub(strField,1,8) == "g_Entity") or (string.sub(strField,1,16) == "radarObjectives[") then ldvar = nil else ldvar = load(strField) end else if string.sub(strField,1,16) == "g_objectiveCount" then ldvar = nil else ldvar = load(strField) -- no numerc subscript end end if ldvar and type(ldvar) == "function" then ldvar() end -- skip bad lines as bad lines crash gg also check for bug reported in 2002 re incorrect type returned from load end strField = file:read() end -- end of file file:close() end return successful --successful = 1 success set in file end function autoload_main(e) end