Browse Source

Add system.isKeyDown

Josip Miskovic 3 years ago
parent
commit
df297f48be
1 changed files with 19 additions and 0 deletions
  1. 19 0
      api/lovr/system/isKeyDown.lua

+ 19 - 0
api/lovr/system/isKeyDown.lua

@@ -0,0 +1,19 @@
+return {
+  tag = 'input',
+  summary = 'Get the state of a key.',
+  description = 'Returns whether a key on the keyboard is pressed.',
+  arguments = {
+    {
+      name = 'key',
+      type = 'KeyCode',
+      description = 'The key.'
+    }
+  },
+  returns = {
+    {
+      name = 'down',
+      type = 'boolean',
+      description = 'Whether the key is currently pressed.'
+    }
+  }
+}