mirror of
https://github.com/kepler155c/opus
synced 2024-12-31 19:00:27 +00:00
Show serialized packet in packetGrid
This commit is contained in:
parent
f1b9dcc4f4
commit
ae2ea81d1d
@ -13,7 +13,7 @@ table.insert(gridColumns, { heading = '#', key = 'id', width = 5, align = 'righ
|
||||
table.insert(gridColumns, { heading = 'Port', key = 'portid', width = 5, align = 'right' })
|
||||
table.insert(gridColumns, { heading = 'Reply', key = 'replyid', width = 5, align = 'right' })
|
||||
if UI.defaultDevice.width > 50 then table.insert(gridColumns, { heading = 'Dist', key = 'distance', width = 6, align = 'right' }) end
|
||||
table.insert(gridColumns, { heading = 'Msg', key = 'message' })
|
||||
table.insert(gridColumns, { heading = 'Msg', key = 'packetStr' })
|
||||
|
||||
local page = UI.Page {
|
||||
paused = false,
|
||||
@ -269,6 +269,8 @@ end
|
||||
function page.packetGrid:addPacket(packet)
|
||||
if not page.paused and (not filterConfig.filterAllCheck.value or filterConfig.filterGrid.values[packet.portid]) then
|
||||
page.index = page.index + 1
|
||||
local p, res = pcall(textutils.serialize, packet.message)
|
||||
packet.packetStr = res:gsub("\n%s*", "")
|
||||
table.insert(self.values, packet)
|
||||
end
|
||||
if #self.values > self.maxPacket then
|
||||
@ -341,7 +343,7 @@ function page:eventHandler(event)
|
||||
end
|
||||
|
||||
Event.on('modem_message', function(event, side, chan, reply, msg, dist)
|
||||
if modemConfig.currentModem.side == side then
|
||||
if modemConfig.currentModem.side == side then
|
||||
page.packetGrid:addPacket({
|
||||
id = page.index,
|
||||
portid = chan,
|
||||
|
Loading…
Reference in New Issue
Block a user