1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-20 15:18:06 +00:00

socket improvement

This commit is contained in:
kepler155c@gmail.com
2017-05-09 01:57:00 -04:00
parent ab73e3f2f9
commit f866d2bd58
10 changed files with 158 additions and 98 deletions

View File

@@ -21,7 +21,7 @@ function Util.tryTimes(attempts, f, ...)
return unpack(result)
end
function Util.print(pattern, ...)
function Util.tostring(pattern, ...)
local function serialize(tbl, width)
local str = '{\n'
@@ -43,12 +43,15 @@ function Util.print(pattern, ...)
end
if type(pattern) == 'string' then
print(string.format(pattern, ...))
return string.format(pattern, ...)
elseif type(pattern) == 'table' then
print(serialize(pattern, term.current().getSize()))
else
print(tostring(pattern))
return serialize(pattern, term.current().getSize())
end
return tostring(pattern)
end
function Util.print(pattern, ...)
print(Util.tostring(pattern, ...))
end
function Util.runFunction(env, fn, ...)