Update follow_me.lua

1. Use `cache` class so now it generates memcache events.
2. Do not use nested if (simplify code)
3. Use local variables.
4. Remove redundant checks.
This commit is contained in:
Alexey Melnichuk
2015-11-05 18:02:08 +03:00
parent f87195204c
commit ddaae7eec5
2 changed files with 134 additions and 144 deletions

View File

@@ -23,6 +23,14 @@ function channel_evalute(uuid, cmd)
return result
end
function channel_display(uuid, text)
local cmd = ("uuid_display %s '%s'"):format(uuid, text)
local result = trim(api:executeString(cmd))
if result:sub(1, 4) == '-ERR' then return nil, result end
if result == '_undef_' then return false end
return result
end
local _switchname
local function switchname()
if _switchname then return _switchname end