made read_config in hiscore lua plugin more robust

This commit is contained in:
Andrea 2020-01-04 10:10:19 +01:00 committed by GitHub
parent 88909dc0d0
commit 9764233875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,8 +46,10 @@ function hiscore.startplugin()
emu.print_verbose( "hiscore: config found" );
local _conf = {}
for line in io.lines(config_path) do
token, value = string.match(line, '([^ ]+) ([^ ]+)');
_conf[token] = value;
token, spaces, value = string.match(line, '([^ ]+)([ ]+)([^ ]+)');
if token ~= nil and token ~= '' then
_conf[token] = value;
end
end
hiscore_path = lfs.env_replace(_conf["hi_path"] or hiscore_path);
timed_save = _conf["only_save_at_exit"] ~= "1"