1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-07-01 09:32:54 +00:00
SquidDev 037cbabb32 Merge branch 'master' into mc-1.14.x
Unfortunately we can't apply the config changes due to backwards
compatibility. This'll be something we may need to PR into Forge.

CraftTweaker support still needs to be added.
2019-12-23 22:34:30 +00:00

41 lines
820 B
Lua

local tArgs = { ... }
if not commands then
printError( "Requires a Command Computer." )
return
end
if #tArgs == 0 then
printError( "Usage: exec <command>" )
return
end
local function printSuccess( text )
if term.isColor() then
term.setTextColor( colors.green )
end
print( text )
term.setTextColor( colors.white )
end
local sCommand = string.lower( tArgs[1] )
for n = 2, #tArgs do
sCommand = sCommand .. " " .. tArgs[n]
end
local bResult, tOutput = commands.exec( sCommand )
if bResult then
printSuccess( "Success" )
if #tOutput > 0 then
for n = 1, #tOutput do
print( tOutput[n] )
end
end
else
printError( "Failed" )
if #tOutput > 0 then
for n = 1, #tOutput do
print( tOutput[n] )
end
end
end