优化控制台sudo命令的交互 close #171

This commit is contained in:
MrZ626
2021-08-07 15:27:38 +08:00
parent f6e3b35482
commit 6713f48361

View File

@@ -638,7 +638,15 @@ local commands={}do
commands.sudo={
code=function(code)
if sudomode then
local success,result=pcall(loadstring(code))
--Filter ""
if #code==0 then log{C.R,"Usage: sudo [Lua code]"}return end
--Check Syntax error
local func,errmsg=loadstring(code)
if errmsg then log{C.R,errmsg}return end
--Run code
local success,result=pcall(func)
if success then
if result~=nil then
log{C.lG,">> "..tostring(result)}