mirror of
https://github.com/kepler155c/opus
synced 2025-10-20 02:07:39 +00:00
cleanup
This commit is contained in:
@@ -5,7 +5,6 @@ local Util = require('util')
|
||||
|
||||
local device = _G.device
|
||||
local os = _G.os
|
||||
--local transport = _G.transport
|
||||
|
||||
local socketClass = { }
|
||||
|
||||
@@ -109,7 +108,7 @@ end
|
||||
function Socket.connect(host, port)
|
||||
|
||||
local socket = newSocket(host == os.getComputerID())
|
||||
socket.dhost = host
|
||||
socket.dhost = tonumber(host)
|
||||
Logger.log('socket', 'connecting to ' .. port)
|
||||
|
||||
socket.transmit(port, socket.sport, {
|
||||
|
@@ -121,7 +121,7 @@ function Manager:init()
|
||||
local event = self:pointToChild(self.target, x, y)
|
||||
_ENV.multishell.openTab({
|
||||
path = 'sys/apps/Lua.lua',
|
||||
args = { event.element, self:dump(self.currentPage) },
|
||||
args = { event.element },
|
||||
focused = true })
|
||||
|
||||
elseif ch and self.currentPage then
|
||||
@@ -438,31 +438,6 @@ function Manager:exitPullEvents()
|
||||
Event.exitPullEvents()
|
||||
end
|
||||
|
||||
function Manager:dump(inEl)
|
||||
if inEl then
|
||||
local function clean(el)
|
||||
local o = el
|
||||
el = Util.shallowCopy(el)
|
||||
el.parent = nil
|
||||
if el.children then
|
||||
local children = { }
|
||||
for k,c in pairs(el.children) do
|
||||
children[k] = clean(c)
|
||||
end
|
||||
el.children = children
|
||||
end
|
||||
for k,v in pairs(o) do
|
||||
if type(v) == 'table' and v.UIElement then
|
||||
el[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
return el
|
||||
end
|
||||
return clean(inEl)
|
||||
end
|
||||
end
|
||||
|
||||
local UI = Manager()
|
||||
|
||||
--[[-- Basic drawable area --]]--
|
||||
|
@@ -262,7 +262,9 @@ end
|
||||
function Util.size(list)
|
||||
if type(list) == 'table' then
|
||||
local length = 0
|
||||
table.foreach(list, function() length = length + 1 end)
|
||||
for _ in pairs(list) do
|
||||
length = length + 1
|
||||
end
|
||||
return length
|
||||
end
|
||||
return 0
|
||||
@@ -433,8 +435,7 @@ function Util.runUrl(env, url, ...) -- os.run equivalent
|
||||
setmetatable(env, { __index = _G })
|
||||
local fn, m = Util.loadUrl(url, env)
|
||||
if fn then
|
||||
local args = { ... }
|
||||
return pcall(function() return fn(table.unpack(args)) end)
|
||||
return pcall(fn, ...)
|
||||
end
|
||||
return fn, m
|
||||
end
|
||||
@@ -443,8 +444,7 @@ function Util.run(env, path, ...)
|
||||
setmetatable(env, { __index = _G })
|
||||
local fn, m = loadfile(path, env)
|
||||
if fn then
|
||||
local args = { ... }
|
||||
return pcall(function() return fn(table.unpack(args)) end)
|
||||
return pcall(fn, ...)
|
||||
end
|
||||
return fn, m
|
||||
end
|
||||
@@ -452,9 +452,7 @@ end
|
||||
function Util.runFunction(env, fn, ...)
|
||||
setfenv(fn, env)
|
||||
setmetatable(env, { __index = _G })
|
||||
|
||||
local args = { ... }
|
||||
return pcall(function() return fn(table.unpack(args)) end)
|
||||
return pcall(fn, ...)
|
||||
end
|
||||
|
||||
--[[ String functions ]] --
|
||||
|
Reference in New Issue
Block a user