Changed some stuff, added the whole controller script

This commit is contained in:
aiden@zuchtbude.de
2020-05-03 19:41:25 +02:00
parent 66d96b567d
commit f31502b030
6 changed files with 148 additions and 48 deletions
+32
View File
@@ -0,0 +1,32 @@
-- LUA SWITCH / CASE
function switch(t)
t.case = function (self,x)
local f=self[x] or self.default
if f then
if type(f)=="function" then
f(x,self)
else
error("case "..tostring(x).." not a function")
end
end
end
return t
end
--actions = switch {
-- ["18873940"] = function()
-- print("Door has been opened : " .. user .. " MagReader : " .. address)
-- doorCtrl()
-- end,
-- ["99447582"] = function()
-- print("Exiting process : " .. user)
-- os.exit()
-- end,
-- default = function()
-- print("Code is not correct : " .. user)
-- end,
--}
--actions:case(code)