diff options
author | 2019-12-02 21:15:48 -0600 | |
---|---|---|
committer | 2019-12-02 21:17:42 -0600 | |
commit | c6dcf7e6bea2658f1dfc4d4fe62d7c5ef85138b2 (patch) | |
tree | a423de475e6321dc190a19acd0fbb5405ca711b1 /plugins/data | |
parent | 8300cf72547e665c37b6ed5a3ebd07266fa234f5 (diff) |
hiscore.dat: Updates [Leezer]
plugins/data: various fixes (nw)
Diffstat (limited to 'plugins/data')
-rw-r--r-- | plugins/data/data_hiscore.lua | 18 | ||||
-rw-r--r-- | plugins/data/load_dat.lua | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/plugins/data/data_hiscore.lua b/plugins/data/data_hiscore.lua index 9c888ddffdf..515b87a2302 100644 --- a/plugins/data/data_hiscore.lua +++ b/plugins/data/data_hiscore.lua @@ -86,8 +86,9 @@ end function env.byte_trim(bytes, val) val = tonumber(val) - for i = 1, #bytes do - if bytes[i] ~= val then + len = #bytes + for i = 1, len do + if bytes[1] ~= val then return bytes end table.remove(bytes, 1) @@ -95,6 +96,19 @@ function env.byte_trim(bytes, val) return bytes end +function env.byte_trunc(bytes, val) + val = tonumber(val) + for i = 1, #bytes do + if bytes[i] == val then + break + end + end + while #bytes >= i do + table.remove(bytes) + end + return bytes +end + function env.byte_swap(bytes, val) local newbytes = {} val = tonumber(val) diff --git a/plugins/data/load_dat.lua b/plugins/data/load_dat.lua index 172f2ef71ca..024dbac0ad3 100644 --- a/plugins/data/load_dat.lua +++ b/plugins/data/load_dat.lua @@ -46,7 +46,7 @@ function datfile.open(file, vertag, fixupcb) if not fh and dbver then -- data in database but missing file, just use what we have - return read, dbver + return readret(file), dbver elseif not fh then return nil elseif not dbver then @@ -77,7 +77,7 @@ function datfile.open(file, vertag, fixupcb) end if ver == dbver then fh:close() - return read, dbver + return readret(file), dbver end if dbver then |