You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local logs=manager:machine():debugger().consolelog
local leng=#logs
for i=0,leng do
local line=logs[i]
print("line"..tostring(line))
if( (line ~= nil) and (line ~= "") ) then
table.insert(self.alllogs,line,line)
Lua arrays are 1 based to 0 will always be nil. Also, the consolelog is not a normal array as it's a ringbuffer so #consolelog will indicate the index of the last item added but if it wraps the current first index may not be 1.
Lua arrays are 1 based to 0 will always be nil. Also, the consolelog is not a normal array as it's a ringbuffer so #consolelog will indicate the index of the last item added but if it wraps the current first index may not be 1.
in my code "foreach consolelog table.insert(self.alllogs " logs is empty !
lua how to get all logs to remove duplicate lines frist and save to file?
not direct save to file because duplicate lines is file too big.
Activity
cracyc commentedon Oct 12, 2020
The consolelog doesn't exist unless the debugger is enabled.
zengfr commentedon Oct 12, 2020
debugger is enabled and is actived . and leng=#logs length>0 but all items is nil
cracyc commentedon Oct 12, 2020
Lua arrays are 1 based to 0 will always be nil. Also, the consolelog is not a normal array as it's a ringbuffer so #consolelog will indicate the index of the last item added but if it wraps the current first index may not be 1.
zengfr commentedon Oct 13, 2020
in my code "foreach consolelog table.insert(self.alllogs " logs is empty !
lua how to get all logs to remove duplicate lines frist and save to file?
not direct save to file because duplicate lines is file too big.
cracyc commentedon Oct 13, 2020
IMO you'd be better off logging everything then using uniq to remove duplicate lines afterward.