2023-10-17 17:33:42 +01:00
|
|
|
load_results = function(filename)
|
|
|
|
results = {}
|
2023-10-18 00:16:37 +01:00
|
|
|
Global_state.results = {} -- cache ordering for when we modify Data
|
2023-10-17 17:33:42 +01:00
|
|
|
local f, err = App.open_for_reading(filename)
|
|
|
|
if err then error(err) end
|
|
|
|
for line in f:lines() do
|
|
|
|
local subject, object = line:match('^%s*(%S+)%s+beat%s+(%S+)%s*$')
|
2023-10-18 00:16:37 +01:00
|
|
|
table.insert(Global_state.results, {subject, object})
|
2023-10-17 17:33:42 +01:00
|
|
|
if subject == nil then
|
|
|
|
error('incorrect format: '..line)
|
|
|
|
end
|
|
|
|
if results[subject] == nil then
|
|
|
|
results[subject] = {}
|
|
|
|
end
|
|
|
|
results[subject][object] = 2
|
|
|
|
if results[object] == nil then
|
|
|
|
results[object] = {}
|
|
|
|
end
|
|
|
|
results[object][subject] = 0
|
|
|
|
end
|
|
|
|
f:close()
|
|
|
|
return results
|
|
|
|
end
|