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

View File

@@ -4,4 +4,10 @@ function print(...)
msg = msg .. tostring(v) .. "\t"
end
Logger.log(LogInfo, msg)
end
function createEnvironment()
local env = { }
setmetatable(env, { __index = _G} )
return env
end