Browse Source

Update loader;

bjorn 6 năm trước cách đây
mục cha
commit
38f117644e
2 tập tin đã thay đổi với 358 bổ sung1224 xóa
  1. 357 1218
      api/init.lua
  2. 1 6
      api/main.lua

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 357 - 1218
api/init.lua


+ 1 - 6
api/main.lua

@@ -1,10 +1,5 @@
 local serpent = require 'serpent'
 local serpent = require 'serpent'
 
 
--- Make sure init.lua can be required
-if not package.path:match('%./?/init%.lua') then
-  package.path = package.path .. ';./?/init.lua'
-end
-
 -- Helpers
 -- Helpers
 local function copy(t)
 local function copy(t)
   if type(t) ~= 'table' then return t end
   if type(t) ~= 'table' then return t end
@@ -181,7 +176,7 @@ local function processObject(path, parent)
 end
 end
 
 
 local function processModule(path)
 local function processModule(path)
-  local module = require(path)
+  local module = require(path .. '.init') -- So we avoid requiring the module itself
 
 
   module.key = module.external and path:match('[^/]+$') or path:gsub('/', '.')
   module.key = module.external and path:match('[^/]+$') or path:gsub('/', '.')
   module.name = module.external and module.key or module.key:match('[^%.]+$')
   module.name = module.external and module.key or module.key:match('[^%.]+$')

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác