Skip to content

lua the array manager:machine():debugger().consolelog items is all nil #7344

@zengfr

Description

@zengfr

lua the array manager:machine():debugger().consolelog items is all nil

mame64 ffight -autoboot_delay 0 -autoboot_script D:\mame\dbg.lua

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)

	end
end

Activity

cracyc

cracyc commented on Oct 12, 2020

@cracyc
Member

The consolelog doesn't exist unless the debugger is enabled.

zengfr

zengfr commented on Oct 12, 2020

@zengfr
Author

The consolelog doesn't exist unless the debugger is enabled.

debugger is enabled and is actived . and leng=#logs length>0 but all items is nil

cracyc

cracyc commented on Oct 12, 2020

@cracyc
Member

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

zengfr commented on Oct 13, 2020

@zengfr
Author

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.

cracyc

cracyc commented on Oct 13, 2020

@cracyc
Member

IMO you'd be better off logging everything then using uniq to remove duplicate lines afterward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @angelosa@cracyc@zengfr

        Issue actions

          lua the array manager:machine():debugger().consolelog items is all nil · Issue #7344 · mamedev/mame