Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. print("LUA: initialization")
  2.  
  3. __commands = {}
  4.  
  5. function register_command(rule, fun)
  6.     __commands[rule] = fun
  7. end
  8.  
  9. function eval_event(channel, user, message)
  10.     print("EVAL: ", channel, user, message)
  11.     for rule, fun in pairs(__commands) do
  12.         print("CHECKING RULE", rule)
  13.         if string.match(message, rule) == message then
  14.             print("MATCHING.")
  15.             return fun(channel, user, message)
  16.         end
  17.     end
  18. end
  19.  
  20. register_command(".*", function(c, u, m) print("you said", c, u, m) end)
  21.  
  22. print("LUA: initialized.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement