Drop unnecessary "*l" parameter to read()

This commit is contained in:
Shy 2024-08-29 08:14:18 +02:00
parent 525b98cf10
commit 418215d4a6

20
c4mate
View file

@ -144,17 +144,17 @@ sed -n '
while true do while true do
local entry = {} local entry = {}
local oldbalance = tonumber(pipe:read("*l")) local oldbalance = tonumber(pipe:read())
if oldbalance == nil then break end if oldbalance == nil then break end
entry.oldbalance = oldbalance entry.oldbalance = oldbalance
entry.newbalance = tonumber(pipe:read("*l")) entry.newbalance = tonumber(pipe:read())
entry.parameter = tonumber(pipe:read("*l")) entry.parameter = tonumber(pipe:read())
entry.method = pipe:read("*l") entry.method = pipe:read()
if entry.method == "buy" or entry.method == "recharge" then if entry.method == "buy" or entry.method == "recharge" then
entry.name = utf8_decode(pipe:read("*l")) entry.name = utf8_decode(pipe:read())
else else
-- set_balance, transferTo, transferFrom -- set_balance, transferTo, transferFrom
entry.reason = utf8_decode(pipe:read("*l")) entry.reason = utf8_decode(pipe:read())
end end
table.insert(log, entry) table.insert(log, entry)
end end
@ -172,7 +172,7 @@ sed -n '
-- Convert timestamps to local time. -- Convert timestamps to local time.
local timestamps = io.popen("date -f "..datefile.." +'%_c'") local timestamps = io.popen("date -f "..datefile.." +'%_c'")
for i = 1, #log do for i = 1, #log do
log[i].time = timestamps:read("*l") log[i].time = timestamps:read()
end end
-- Check date exit code. -- Check date exit code.
@ -249,10 +249,10 @@ sed -n --sandbox '
while true do while true do
local item = {} local item = {}
item.id = tonumber(pipe:read("*l")) item.id = tonumber(pipe:read())
if item.id == nil then break end if item.id == nil then break end
item.name = utf8_decode(pipe:read("*l")) item.name = utf8_decode(pipe:read())
item.price = tonumber(pipe:read("*l")) item.price = tonumber(pipe:read())
table.insert(roster, item) table.insert(roster, item)
end end