Browse Source

require path changes;

bjorn 7 years ago
parent
commit
1bbbd80a54
2 changed files with 25 additions and 3 deletions
  1. 11 1
      api/lovr/filesystem/getRequirePath.lua
  2. 14 2
      api/lovr/filesystem/setRequirePath.lua

+ 11 - 1
api/lovr/filesystem/getRequirePath.lua

@@ -6,6 +6,11 @@ return {
     be replaced with the module that is being required.  It is similar to Lua\'s `package.path`
     be replaced with the module that is being required.  It is similar to Lua\'s `package.path`
     variable, but the main difference is that the patterns are relative to the save directory and
     variable, but the main difference is that the patterns are relative to the save directory and
     the project directory.
     the project directory.
+
+    For the C require path, double question marks will be replaced by the name of the module with
+    the operating system's native extension for shared libraries.  For example, if you do
+    `require('lib')` and the C require path is `??`, LÖVR will try to load `lib.dll` if you're on
+    Windows or `lib.so` if you're on Linux.
   ]],
   ]],
   arguments = {},
   arguments = {},
   returns = {
   returns = {
@@ -13,9 +18,14 @@ return {
       name = 'path',
       name = 'path',
       type = 'string',
       type = 'string',
       description = 'The semicolon separated list of search patterns.'
       description = 'The semicolon separated list of search patterns.'
+    },
+    {
+      name = 'cpath',
+      type = 'string',
+      description = 'The semicolon separated list of search patterns for C libraries.'
     }
     }
   },
   },
   notes = [[
   notes = [[
-    The default reqiure path is '?.lua;?/init.lua'.
+    The default reqiure path is '?.lua;?/init.lua'.  The default C require path is '??'.
   ]]
   ]]
 }
 }

+ 14 - 2
api/lovr/filesystem/setRequirePath.lua

@@ -6,16 +6,28 @@ return {
     be replaced with the module that is being required.  It is similar to Lua\'s `package.path`
     be replaced with the module that is being required.  It is similar to Lua\'s `package.path`
     variable, but the main difference is that the patterns are relative to the save directory and
     variable, but the main difference is that the patterns are relative to the save directory and
     the project directory.
     the project directory.
+
+    For the C require path, double question marks will be replaced by the name of the module with
+    the operating system's native extension for shared libraries.  For example, if you do
+    `require('lib')` and the C require path is `??`, LÖVR will try to load `lib.dll` if you're on
+    Windows or `lib.so` if you're on Linux.
   ]],
   ]],
   arguments = {
   arguments = {
     {
     {
       name = 'path',
       name = 'path',
       type = 'string',
       type = 'string',
-      description = 'The semicolon separated list of search patterns.'
+      default = 'nil',
+      description = 'An optional semicolon separated list of search patterns.'
+    },
+    {
+      name = 'cpath',
+      type = 'string',
+      default = 'nil',
+      description = 'An optional semicolon separated list of search patterns for C libraries.'
     }
     }
   },
   },
   returns = {},
   returns = {},
   notes = [[
   notes = [[
-    The default reqiure path is '?.lua;?/init.lua'.
+    The default reqiure path is '?.lua;?/init.lua'.  The default C require path is '??'.
   ]]
   ]]
 }
 }