diff --git a/common/Events.lua b/common/Events.lua index f2539af..4d0d29c 100644 --- a/common/Events.lua +++ b/common/Events.lua @@ -30,15 +30,8 @@ local page = UI.Page { getDisplayValues = function(_, row) row = Util.shallowCopy(row) - local function tovalue(s) - if type(s) == 'table' then - return 'table' - end - return s - end - for k,v in pairs(row) do - row[k] = tovalue(v) + row[k] = type(v) == 'table' and 'table' or v end return row @@ -95,30 +88,25 @@ local page = UI.Page { end, } -local updated = false local timerId = os.startTimer(1) Event.addRoutine(function() while true do local _, id = os.pullEvent('timer') if id == timerId then - if updated then - while #page.grid.values > 100 do -- page.grid.height do - table.remove(page.grid.values, 100) -- #page.grid.values) - end - updated = false - page.grid:update() - page.grid:draw() - page:sync() + while #page.grid.values > 100 do + table.remove(page.grid.values) end - timerId = os.startTimer(1) + timerId = nil + page.grid:update() + page.grid:draw() + page:sync() end end end) local hookFunction = function(event, e) if not page.filtered[event] and not page.paused and not (event == 'timer' and e[1] == timerId) then - updated = true table.insert(page.grid.values, 1, { event = event, p1 = e[1], @@ -127,6 +115,7 @@ local hookFunction = function(event, e) p4 = e[4], p5 = e[5], }) + timerId = timerId or os.startTimer(.1) end end diff --git a/common/autorun/common.lua b/common/autorun/common.lua index 2c9b53e..0e1cbb1 100644 --- a/common/autorun/common.lua +++ b/common/autorun/common.lua @@ -6,3 +6,49 @@ end _ENV.shell.setCompletionFunction("packages/common/edit.lua", c) _ENV.shell.setCompletionFunction("packages/common/hexedit.lua", c) + +_ENV.shell.registerHandler(function(env, command, args) + if command:match('^!') then + return { + title = 'lua', + path = table.concat({ command:match('^!(.+)'), table.unpack(args) }, ' '), + args = args, + load = function(s) + return function() + local fn, m + local wrapped + + fn = load('return (' ..s.. ')', 'lua', nil, env) + + if fn then + fn = load('return {' ..s.. '}', 'lua', nil, env) + wrapped = true + end + + if fn then + fn, m = pcall(fn) + if #m <= 1 and wrapped then + m = m[1] + end + else + fn, m = load(s, 'lua', nil, env) + if fn then + fn, m = pcall(fn) + end + end + + if fn then + if m or wrapped then + require('opus.util').print(m or 'nil') + else + print() + end + else + _G.printError(m) + end + end + end, + env = env, + } + end +end) diff --git a/common/etc/fstab b/common/etc/fstab index e636640..2b43563 100644 --- a/common/etc/fstab +++ b/common/etc/fstab @@ -3,4 +3,6 @@ packages/common/hexedit.lua urlfs https://pastebin.com/raw/Ds9ajsp4 packages/common/colors.lua urlfs https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/ignore/colors.lua packages/common/cowsay.lua urlfs https://pastebin.com/raw/n00VQJsw packages/common/calc.lua urlfs https://pastebin.com/raw/nAinUn1h -packages/common/write.lua urlfs https://pastebin.com/raw/RSyhCjqv \ No newline at end of file +packages/common/write.lua urlfs https://pastebin.com/raw/RSyhCjqv +# pretty output +rom/modules/main/inpsect.lua urlfs https://raw.githubusercontent.com/kikito/inspect.lua/master/inspect.lua diff --git a/debugger/etc/apps.db b/debugger/etc/apps.db index 7f8a171..186c7ce 100644 --- a/debugger/etc/apps.db +++ b/debugger/etc/apps.db @@ -3,5 +3,6 @@ run = "fileui --exec=debug.lua --title=debug", title = "Debug", category = "Apps", + iconExt = "\30\50\31\50\128\31\102\152\144\30\102\31\50\159\155\30\50\128\10\30\50\31\102\130\152\30\101\31\53\143\143\30\102\31\50\155\30\50\31\102\129\10\30\50\31\102\130\31\50\128\31\101\134\137\31\50\128\31\102\129", }, } diff --git a/milo/MiloLocal.lua b/milo/MiloLocal.lua index 7ba699b..ed1c282 100644 --- a/milo/MiloLocal.lua +++ b/milo/MiloLocal.lua @@ -219,7 +219,9 @@ local s, m = pcall(function() UI:start() end) -turtle.setStatus('idle') +if turtle.setStatus then + turtle.setStatus('idle') +end _G._syslog = oldDebug if not s then error(m) end