控制台执行lua代码时sudo模式开关会影响输出文本颜色

This commit is contained in:
MrZ626
2021-08-27 22:42:47 +08:00
parent 660946215e
commit 3e1220fa0e

View File

@@ -910,13 +910,19 @@ function scene.keyDown(key)
log{C.lC,"> "..input}
local code,err=loadstring(input:sub(2))
if code then
if not sudomode then setfenv(code,userG)end
local resultColor
if sudomode then
resultColor=C.lY
else
setfenv(code,userG)
resultColor=C.lG
end
local success,result=pcall(code)
if success then
if result~=nil then
log{C.lG,">> "..tostring(result)}
log{resultColor,">> "..tostring(result)}
else
log{C.lG,"done"}
log{resultColor,"done"}
end
else
log{C.R,result}