Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numpad(str,mode)
- if mode then
- if mode == "control" then
- -- do stuff you want to do when CTRL is held
- return true
- elseif mode == "alt" then
- -- do stuff you want to do when ALT is held
- return true
- elseif mode == "shift" then
- -- do stuff you want to do when SHIFT is held
- return true
- end
- end
- -- lowercase the string for ease of comparison.
- str = str:lower()
- -- if mode isn't set or we don't know what to do with the mode supplied, we move
- -- on to the rest of the script.
- if str == "n" then
- -- do things we want to do when 8 is pressed.
- return true
- elseif str == "s" then
- -- do things we want to do when 2 is pressed.
- return true
- elseif str == "e" then
- -- do things we want to do when 6 is pressed.
- return true
- else
- -- if the supplied str isn't a direction we know what to do with, we don't do anything.
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement