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`
     variable, but the main difference is that the patterns are relative to the save directory and
     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 = {},
   returns = {
@@ -13,9 +18,14 @@ return {
       name = 'path',
       type = 'string',
       description = 'The semicolon separated list of search patterns.'
+    },
+    {
+      name = 'cpath',
+      type = 'string',
+      description = 'The semicolon separated list of search patterns for C libraries.'
     }
   },
   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`
     variable, but the main difference is that the patterns are relative to the save directory and
     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 = {
     {
       name = 'path',
       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 = {},
   notes = [[
-    The default reqiure path is '?.lua;?/init.lua'.
+    The default reqiure path is '?.lua;?/init.lua'.  The default C require path is '??'.
   ]]
 }