bjorn 7 年 前
コミット
43f81886e7
1 ファイル変更41 行追加35 行削除
  1. 41 35
      api/init.lua

+ 41 - 35
api/init.lua

@@ -469,6 +469,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.",
@@ -1715,23 +1748,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",
@@ -2162,9 +2178,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 = {
@@ -2187,9 +2206,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 = {
@@ -7778,22 +7800,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",