控制台执行lua代码时sudo模式开关会影响输出文本颜色
This commit is contained in:
@@ -910,13 +910,19 @@ function scene.keyDown(key)
|
|||||||
log{C.lC,"> "..input}
|
log{C.lC,"> "..input}
|
||||||
local code,err=loadstring(input:sub(2))
|
local code,err=loadstring(input:sub(2))
|
||||||
if code then
|
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)
|
local success,result=pcall(code)
|
||||||
if success then
|
if success then
|
||||||
if result~=nil then
|
if result~=nil then
|
||||||
log{C.lG,">> "..tostring(result)}
|
log{resultColor,">> "..tostring(result)}
|
||||||
else
|
else
|
||||||
log{C.lG,"done"}
|
log{resultColor,"done"}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
log{C.R,result}
|
log{C.R,result}
|
||||||
|
|||||||
Reference in New Issue
Block a user