💾 Archived View for gemini.conman.org › extensions › port70 › handlers › debug.lua captured on 2020-11-01 at 00:00:20.
-=-=-=-=-=-=-
-- ************************************************************************ -- -- A debug module that allows me an interactive view into a Lua state -- Copyright 2020 by Sean Conner. All Rights Reserved. -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Comments, questions and criticisms can be sent to: sean@conman.org -- -- ************************************************************************ -- luacheck: globals handler -- luacheck: ignore 611 local luaview = require "org.flummux.luaview" local nfl = require "org.conman.nfl" local coroutine = require "coroutine" _ENV = {} function handler(conf) if not conf.co then conf.co = coroutine.running() luaview.init() nfl.SOCKETS:insert(luaview,'r',function() if not luaview.step() then nfl.schedule(conf.co) end end) coroutine.yield() nfl.SOCKETS:remove(luaview) luaview.close() conf.co = nil return true,"FINISHED\n" else return true,"RUNNING\n" end end return _ENV