Browse Source

More docs;

bjorn 9 months ago
parent
commit
40ea0bb212

+ 70 - 2
api/init.lua

@@ -43755,6 +43755,26 @@ return {
         }
         }
       },
       },
       functions = {
       functions = {
+        {
+          name = "getClipboardText",
+          tag = "system-clipboard",
+          summary = "Get the clipboard text.",
+          description = "Returns the clipboard text.",
+          key = "lovr.system.getClipboardText",
+          module = "lovr.system",
+          variants = {
+            {
+              arguments = {},
+              returns = {
+                {
+                  name = "text",
+                  type = "string",
+                  description = "The clipboard text (may be nil)."
+                }
+              }
+            }
+          }
+        },
         {
         {
           name = "getCoreCount",
           name = "getCoreCount",
           tag = "system-info",
           tag = "system-info",
@@ -44192,6 +44212,26 @@ return {
             }
             }
           }
           }
         },
         },
+        {
+          name = "setClipboardText",
+          tag = "system-clipboard",
+          summary = "Set the clipboard text.",
+          description = "Sets the clipboard text.",
+          key = "lovr.system.setClipboardText",
+          module = "lovr.system",
+          variants = {
+            {
+              arguments = {
+                {
+                  name = "text",
+                  type = "string",
+                  description = "The string to set as the clipboard text."
+                }
+              },
+              returns = {}
+            }
+          }
+        },
         {
         {
           name = "setKeyRepeat",
           name = "setKeyRepeat",
           tag = "system-keyboard",
           tag = "system-keyboard",
@@ -44363,6 +44403,10 @@ return {
           name = "Mouse",
           name = "Mouse",
           tag = "system-mouse"
           tag = "system-mouse"
         },
         },
+        {
+          name = "Clipboard",
+          tag = "system-clipboard"
+        },
         {
         {
           name = "Window",
           name = "Window",
           tag = "system-window"
           tag = "system-window"
@@ -44384,7 +44428,8 @@ return {
           key = "lovr.thread.getChannel",
           key = "lovr.thread.getChannel",
           module = "lovr.thread",
           module = "lovr.thread",
           related = {
           related = {
-            "Channel"
+            "Channel",
+            "lovr.thread.newChannel"
           },
           },
           variants = {
           variants = {
             {
             {
@@ -44405,6 +44450,28 @@ return {
             }
             }
           }
           }
         },
         },
+        {
+          name = "newChannel",
+          summary = "Create a new, unnamed Channel.",
+          description = "Creates a new unnamed `Channel` object.  Usually it's more convenient to use `lovr.thread.getChannel`, since other threads can use that function to query the channel by name.  Unnamed channels don't require a unique name, but they need to be sent to other threads somehow (e.g. on a different Channel or as an argument to `Thread:start`).",
+          key = "lovr.thread.newChannel",
+          module = "lovr.thread",
+          related = {
+            "lovr.thread.getChannel"
+          },
+          variants = {
+            {
+              arguments = {},
+              returns = {
+                {
+                  name = "channel",
+                  type = "Channel",
+                  description = "The new Channel."
+                }
+              }
+            }
+          }
+        },
         {
         {
           name = "newThread",
           name = "newThread",
           summary = "Create a new Thread.",
           summary = "Create a new Thread.",
@@ -44472,10 +44539,11 @@ return {
         {
         {
           name = "Channel",
           name = "Channel",
           summary = "A message channel for communicating between threads.",
           summary = "A message channel for communicating between threads.",
-          description = "A Channel is an object used to communicate between `Thread` objects.  Channels are obtained by name using `lovr.thread.getChannel`.  Different threads can send messages on the same Channel to communicate with each other.  Messages can be sent and received on a Channel using `Channel:push` and `Channel:pop`, and are received in a first-in-first-out fashion. The following types of data can be passed through Channels: nil, boolean, number, string, and any LÖVR object.",
+          description = "A Channel is an object used to communicate between `Thread` objects.  Different threads can send messages on the same Channel to communicate with each other.  Messages can be sent and received on a Channel using `Channel:push` and `Channel:pop`, and are received in a first-in-first-out fashion. The following types of data can be passed through Channels: nil, boolean, number, string, lightuserdata, table, vector, and any LÖVR object.",
           key = "Channel",
           key = "Channel",
           module = "lovr.thread",
           module = "lovr.thread",
           constructors = {
           constructors = {
+            "lovr.thread.newChannel",
             "lovr.thread.getChannel"
             "lovr.thread.getChannel"
           },
           },
           methods = {
           methods = {

+ 18 - 0
api/lovr/system/getClipboardText.lua

@@ -0,0 +1,18 @@
+return {
+  tag = 'system-clipboard',
+  summary = 'Get the clipboard text.',
+  description = 'Returns the clipboard text.',
+  arguments = {},
+  returns = {
+    text = {
+      type = 'string',
+      description = 'The clipboard text (may be nil).'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'text' }
+    }
+  }
+}

+ 4 - 0
api/lovr/system/init.lua

@@ -19,6 +19,10 @@ return {
       name = 'Mouse',
       name = 'Mouse',
       tag = 'system-mouse'
       tag = 'system-mouse'
     },
     },
+    {
+      name = 'Clipboard',
+      tag = 'system-clipboard'
+    },
     {
     {
       name = 'Window',
       name = 'Window',
       tag = 'system-window'
       tag = 'system-window'

+ 18 - 0
api/lovr/system/setClipboardText.lua

@@ -0,0 +1,18 @@
+return {
+  tag = 'system-clipboard',
+  summary = 'Set the clipboard text.',
+  description = 'Sets the clipboard text.',
+  arguments = {
+    text = {
+      type = 'string',
+      description = 'The string to set as the clipboard text.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'text' },
+      returns = {}
+    }
+  }
+}

+ 9 - 7
api/lovr/thread/Channel/init.lua

@@ -1,12 +1,14 @@
 return {
 return {
   summary = 'A message channel for communicating between threads.',
   summary = 'A message channel for communicating between threads.',
   description = [[
   description = [[
-    A Channel is an object used to communicate between `Thread` objects.  Channels are obtained by
-    name using `lovr.thread.getChannel`.  Different threads can send messages on the same Channel to
-    communicate with each other.  Messages can be sent and received on a Channel using
-    `Channel:push` and `Channel:pop`, and are received in a first-in-first-out fashion. The
-    following types of data can be passed through Channels: nil, boolean, number, string, and any
-    LÖVR object.
+    A Channel is an object used to communicate between `Thread` objects.  Different threads can send
+    messages on the same Channel to communicate with each other.  Messages can be sent and received
+    on a Channel using `Channel:push` and `Channel:pop`, and are received in a first-in-first-out
+    fashion. The following types of data can be passed through Channels: nil, boolean, number,
+    string, lightuserdata, table, vector, and any LÖVR object.
   ]],
   ]],
-  constructor = 'lovr.thread.getChannel'
+  constructors = {
+    'lovr.thread.newChannel',
+    'lovr.thread.getChannel'
+  }
 }
 }

+ 2 - 1
api/lovr/thread/getChannel.lua

@@ -20,6 +20,7 @@ return {
     }
     }
   },
   },
   related = {
   related = {
-    'Channel'
+    'Channel',
+    'lovr.thread.newChannel'
   }
   }
 }
 }

+ 25 - 0
api/lovr/thread/newChannel.lua

@@ -0,0 +1,25 @@
+return {
+  summary = 'Create a new, unnamed Channel.',
+  description = [[
+    Creates a new unnamed `Channel` object.  Usually it's more convenient to use
+    `lovr.thread.getChannel`, since other threads can use that function to query the channel by
+    name.  Unnamed channels don't require a unique name, but they need to be sent to other threads
+    somehow (e.g. on a different Channel or as an argument to `Thread:start`).
+  ]],
+  arguments = {},
+  returns = {
+    channel = {
+      type = 'Channel',
+      description = 'The new Channel.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'channel' }
+    }
+  },
+  related = {
+    'lovr.thread.getChannel'
+  }
+}