mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-28 16:13:22 +00:00
Eta-reduce several calls to pcall
This commit is contained in:
parent
8b1773dd60
commit
1db3a14c54
|
@ -991,8 +991,7 @@ if fs.exists( ".settings" ) then
|
|||
end
|
||||
|
||||
-- Run the shell
|
||||
local ok, err = pcall( function()
|
||||
parallel.waitForAny(
|
||||
local ok, err = pcall(parallel.waitForAny,
|
||||
function()
|
||||
local sShell
|
||||
if term.isColour() and settings.get( "bios.use_multishell" ) then
|
||||
|
@ -1003,10 +1002,8 @@ local ok, err = pcall( function()
|
|||
os.run( {}, sShell )
|
||||
os.run( {}, "rom/programs/shutdown.lua" )
|
||||
end,
|
||||
function()
|
||||
rednet.run()
|
||||
end )
|
||||
end )
|
||||
rednet.run
|
||||
)
|
||||
|
||||
-- If the shell errored, let the user read it.
|
||||
term.redirect( term.native() )
|
||||
|
|
|
@ -10,7 +10,7 @@ local bRunning = true
|
|||
local tCommandHistory = {}
|
||||
local tEnv = {
|
||||
["exit"] = setmetatable({}, {
|
||||
__tostring = function() return "Call exit() to exit" end,
|
||||
__tostring = function() return "Call exit() to exit." end,
|
||||
__call = function() bRunning = false end,
|
||||
}),
|
||||
["_echo"] = function( ... )
|
||||
|
|
|
@ -105,8 +105,8 @@ if sCommand == "host" then
|
|||
end
|
||||
|
||||
-- Handle messages
|
||||
local ok, error = pcall( function()
|
||||
parallel.waitForAny( function()
|
||||
local ok, error = pcall(parallel.waitForAny,
|
||||
function()
|
||||
while true do
|
||||
local _, timer = os.pullEvent( "timer" )
|
||||
local nUserID = tPingPongTimer[ timer ]
|
||||
|
@ -223,8 +223,8 @@ if sCommand == "host" then
|
|||
end
|
||||
end
|
||||
end
|
||||
end )
|
||||
end )
|
||||
end
|
||||
)
|
||||
if not ok then
|
||||
printError( error )
|
||||
end
|
||||
|
@ -332,8 +332,8 @@ elseif sCommand == "join" then
|
|||
|
||||
drawTitle()
|
||||
|
||||
local ok, error = pcall( function()
|
||||
parallel.waitForAny( function()
|
||||
local ok, error = pcall(parallel.waitForAny,
|
||||
function()
|
||||
while true do
|
||||
local sEvent, timer = os.pullEvent()
|
||||
if sEvent == "timer" then
|
||||
|
@ -402,8 +402,8 @@ elseif sCommand == "join" then
|
|||
table.insert( tSendHistory, sChat )
|
||||
end
|
||||
end
|
||||
end )
|
||||
end )
|
||||
end
|
||||
)
|
||||
|
||||
-- Close the windows
|
||||
term.redirect( parentTerm )
|
||||
|
|
Loading…
Reference in New Issue
Block a user