add coldstore string loading

This commit is contained in:
Not 2022-11-16 16:09:53 +01:00
parent 34da7e2929
commit 0a21799e60
1 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,8 @@ local ColdStore = {}
-- Livestore are new records nad records loaded from leaderboard.txt file -- Livestore are new records nad records loaded from leaderboard.txt file
local LiveStore = {} local LiveStore = {}
-- parse score function
local parseScore
-- GLOBAL -- GLOBAL
-- Returns a list of all maps with records -- Returns a list of all maps with records
@ -40,13 +42,19 @@ end
rawset(_G, "lb_map_list", MapList) rawset(_G, "lb_map_list", MapList)
-- GLOBAL -- GLOBAL
-- Function for adding records from lua -- Function for adding a single record from lua
local function AddColdStore(record) local function AddColdStore(record)
ColdStore[record.map] = $ or {} ColdStore[record.map] = $ or {}
table.insert(ColdStore[record.map], record) table.insert(ColdStore[record.map], record)
end end
rawset(_G, "lb_add_coldstore_record", AddColdStore) rawset(_G, "lb_add_coldstore_record", AddColdStore)
-- GLOBAL
-- Function for adding a single record in string form from lua
local function AddColdStoreString(record)
AddColdStore(parseScore(record))
end
rawset(_G, "lb_add_coldstore_record_string", AddColdStoreString)
-- Insert mode separated records from the flat sourceTable into dest -- Insert mode separated records from the flat sourceTable into dest
local function insertRecords(dest, sourceTable, modeSep) local function insertRecords(dest, sourceTable, modeSep)
@ -204,7 +212,7 @@ local function score_t(map, name, skin, color, time, splits, flags, stat, checks
} }
end end
local function parseScore(str) function parseScore(str)
-- Leaderboard is stored in the following tab separated format -- Leaderboard is stored in the following tab separated format
-- mapnum, name, skin, color, time, splits, flags, stat -- mapnum, name, skin, color, time, splits, flags, stat
local t = {} local t = {}