bjorn 7 years ago
parent
commit
fcf13f62cf
1 changed files with 42 additions and 36 deletions
  1. 42 36
      api/init.lua

+ 42 - 36
api/init.lua

@@ -534,6 +534,39 @@ return {
     }
   },
   modules = {
+    {
+      name = "enet",
+      tag = "library",
+      summary = "Multiplayer utilities.",
+      description = "ENet is a UDP networking library bundled with LÖVR that allows you to create multiplayer experiences.\n\nTo use it, `require` the `enet` module.\n\nMore information, including full documentation and examples can be found on the [lua-enet](http://leafo.net/lua-enet/) page.",
+      key = "enet",
+      functions = {},
+      objects = {},
+      enums = {},
+      external = true,
+      examples = {
+        {
+          description = "Here's a simple echo server example. The client sends a message to the server and waits for a response. The server waits for a message and sends it back to the client.",
+          code = "-- client/main.lua\nlocal enet = require 'enet'\n\nfunction lovr.load()\n  local host = enet.host_create()\n  local server = host:connect('localhost:6789')\n\n  local done = false\n  while not done do\n    local event = host:service(100)\n    if event then\n      if event.type == 'connect' then\n        print('Connected to', event.peer)\n        event.peer:send('hello world')\n      elseif event.type == 'receive' then\n        print('Got message: ', event.data, event.peer)\n        done = true\n      end\n    end\n  end\n\n  server:disconnect()\n  host:flush()\nend\n\n-- server/main.lua\nlocal enet = require 'enet'\n\nfunction lovr.load()\n  local host = enet.host_create('localhost:6789')\n  while true do\n    local event = host:service(100)\n    if event and event.type == 'receive' then\n      print('Got message: ', event.data, event.peer)\n      event.peer:send(event.data)\n    end\n  end\nend"
+        }
+      }
+    },
+    {
+      name = "json",
+      tag = "library",
+      summary = "Encodes and decodes JSON.",
+      description = "The json module exposes functions for encoding and decoding JSON. You can use it by requiring the `json` module.",
+      key = "json",
+      functions = {},
+      objects = {},
+      enums = {},
+      external = true,
+      examples = {
+        {
+          code = "local json = require 'json'\nlocal data = { health = 10, position = { 1, 2, 3 } }\nlocal encoded = json.encode(data)\nprint(encoded)\nlocal decoded = json.decode(encoded)\nprint(decoded.health, unpack(decoded.position))"
+        }
+      }
+    },
     {
       name = "lovr",
       summary = "In the beginning, there was nothing.",
@@ -3814,23 +3847,6 @@ return {
         }
       }
     },
-    {
-      name = "enet",
-      tag = "library",
-      summary = "Multiplayer utilities.",
-      description = "ENet is a UDP networking library bundled with LÖVR that allows you to create multiplayer experiences.\n\nTo use it, `require` the `enet` module.\n\nMore information, including full documentation and examples can be found on the [lua-enet](http://leafo.net/lua-enet/) page.",
-      key = "enet",
-      functions = {},
-      objects = {},
-      enums = {},
-      external = true,
-      examples = {
-        {
-          description = "Here's a simple echo server example. The client sends a message to the server and waits for a response. The server waits for a message and sends it back to the client.",
-          code = "-- client/main.lua\nlocal enet = require 'enet'\n\nfunction lovr.load()\n  local host = enet.host_create()\n  local server = host:connect('localhost:6789')\n\n  local done = false\n  while not done do\n    local event = host:service(100)\n    if event then\n      if event.type == 'connect' then\n        print('Connected to', event.peer)\n        event.peer:send('hello world')\n      elseif event.type == 'receive' then\n        print('Got message: ', event.data, event.peer)\n        done = true\n      end\n    end\n  end\n\n  server:disconnect()\n  host:flush()\nend\n\n-- server/main.lua\nlocal enet = require 'enet'\n\nfunction lovr.load()\n  local host = enet.host_create('localhost:6789')\n  while true do\n    local event = host:service(100)\n    if event and event.type == 'receive' then\n      print('Got message: ', event.data, event.peer)\n      event.peer:send(event.data)\n    end\n  end\nend"
-        }
-      }
-    },
     {
       name = "event",
       tag = "modules",
@@ -4284,9 +4300,12 @@ return {
         {
           name = "isDirectory",
           summary = "Check whether a path is a directory.",
-          description = "Check if a path is a directory.",
+          description = "Check if a path exists and is a directory.",
           key = "lovr.filesystem.isDirectory",
           module = "lovr.filesystem",
+          related = {
+            "lovr.filesystem.isFile"
+          },
           variants = {
             {
               arguments = {
@@ -4309,9 +4328,12 @@ return {
         {
           name = "isFile",
           summary = "Check whether a path is a file.",
-          description = "Check if a path is a file.",
+          description = "Check if a path exists and is a file.",
           key = "lovr.filesystem.isFile",
           module = "lovr.filesystem",
+          related = {
+            "lovr.filesystem.isDirectory"
+          },
           variants = {
             {
               arguments = {
@@ -12756,22 +12778,6 @@ return {
         }
       }
     },
-    {
-      name = "json",
-      tag = "library",
-      summary = "Encodes and decodes JSON.",
-      description = "The json module exposes functions for encoding and decoding JSON. You can use it by requiring the `json` module.",
-      key = "json",
-      functions = {},
-      objects = {},
-      enums = {},
-      external = true,
-      examples = {
-        {
-          code = "local json = require 'json'\nlocal data = { health = 10, position = { 1, 2, 3 } }\nlocal encoded = json.encode(data)\nprint(encoded)\nlocal decoded = json.decode(encoded)\nprint(decoded.health, unpack(decoded.position))"
-        }
-      }
-    },
     {
       name = "math",
       tag = "modules",
@@ -18710,7 +18716,7 @@ return {
       name = "thread",
       tag = "modules",
       summary = "Allows you to work with background threads.",
-      description = "The `lovr.thread` module provides functions for creating threads and communicating between them.\n\nThese are operating system level threads, which are different from Lua coroutines.\n\nThreads are useful for performing expensive background computation without affecting the framerate or performance of the main thread.  Some examples of this include asset loading, networking and network requests, and physics simulation.\n\nThreads come with some limitations though.\n\n- Threads are completely isolated from other threads.  They do not have access to the variables\n  or functions of other threads, and communication between threads must be coordinated through\n  `Channel` objects.\n- The graphics module (or any functions that perform rendering) cannot be used in a thread.\n  Note that this includes creating graphics objects like Models and Textures.  There are \"data\"\n  equivalent `ModelData` and `TextureData` objects that can be used in threads though.\n- Crashes or problems can happen if two threads access the same object at the same time, so\n  special care must be taken to coordinate access to objects from multiple threads.",
+      description = "The `lovr.thread` module provides functions for creating threads and communicating between them.\n\nThese are operating system level threads, which are different from Lua coroutines.\n\nThreads are useful for performing expensive background computation without affecting the framerate or performance of the main thread.  Some examples of this include asset loading, networking and network requests, and physics simulation.\n\nThreads come with some limitations though.\n\n- Threads are completely isolated from other threads.  They do not have access to the variables\n  or functions of other threads, and communication between threads must be coordinated through\n  `Channel` objects.\n- The graphics module (or any functions that perform rendering) cannot be used in a thread.\n  Note that this includes creating graphics objects like Models and Textures.  There are \"data\"\n  equivalent `ModelData` and `TextureData` objects that can be used in threads though.\n- `lovr.event.pump` cannot be called from a thread.\n- Crashes or problems can happen if two threads access the same object at the same time, so\n  special care must be taken to coordinate access to objects from multiple threads.",
       key = "lovr.thread",
       functions = {
         {