libdo

Untitled

Sep 17th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function numpad(str,mode)
  2. if mode then
  3. if mode == "control" then
  4. -- do stuff you want to do when CTRL is held
  5. return true
  6. elseif mode == "alt" then
  7. -- do stuff you want to do when ALT is held
  8. return true
  9. elseif mode == "shift" then
  10. -- do stuff you want to do when SHIFT is held
  11. return true
  12. end
  13. end
  14.  
  15. -- lowercase the string for ease of comparison.
  16. str = str:lower()
  17.  
  18. -- if mode isn't set or we don't know what to do with the mode supplied, we move
  19. -- on to the rest of the script.
  20. if str == "n" then
  21. -- do things we want to do when 8 is pressed.
  22. return true
  23. elseif str == "s" then
  24. -- do things we want to do when 2 is pressed.
  25. return true
  26. elseif str == "e" then
  27. -- do things we want to do when 6 is pressed.
  28. return true
  29. else
  30. -- if the supplied str isn't a direction we know what to do with, we don't do anything.
  31. return false
  32. end
  33.  
  34. end
Add Comment
Please, Sign In to add comment