fix focus bugs in UI

This commit is contained in:
Eduardo Bart
2011-08-20 22:01:46 -03:00
parent d0f47f47a4
commit b410921e32
13 changed files with 68 additions and 70 deletions

View File

@@ -1,6 +1,8 @@
Console = { }
local console
local logLocked = false
local commandEnv = createEnvironment()
function Console.onLog(level, message, time)
-- avoid logging while reporting logs (would cause a infinite loop)
@@ -61,11 +63,14 @@ end
function Console.executeCommand(command)
Console.addLine(">> " .. command, "#ffffff")
local func, err = loadstring("return (" .. command .. ")", "@")
local func, err = loadstring(command, "@")
if func then
setfenv(func, commandEnv)
local ok, ret = pcall(func)
if ok then
Logger.log(LogDebug, "=> " .. tostring(ret))
if ret then
print(ret)
end
else
Logger.log(LogError, 'command failed: ' .. ret)
end