VXP

Command system

VXP
Jan 5th, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. commands = {}
  2. commands["first"] = {
  3.             ["second"] = {
  4.                 ["third"] = "Output message"}}
  5.  
  6. tbl = {}
  7. tbl[1] = "first"
  8. tbl[2] = "second"
  9. tbl[3] = "third"
  10.  
  11. if type(commands[tbl[1]]) == "table" then
  12.     if commands[tbl[1]][tbl[2]] ~= nil then
  13.         if commands[tbl[1]][tbl[2]][tbl[3]] ~= nil then
  14.             return processMessageHelper2( commands[tbl[1]][tbl[2]][tbl[3]] ) -- Wow, such shit!
  15.         else
  16.             return processMessageHelper2( commands[tbl[1]][tbl[2]] )
  17.         end
  18.     else
  19.         return processMessageHelper2( commands[tbl[1]] )
  20.     end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment