summaryrefslogtreecommitdiff
path: root/server/src/core/library.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core/library.lua')
-rw-r--r--server/src/core/library.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/src/core/library.lua b/server/src/core/library.lua
index b268b368..6bceadc4 100644
--- a/server/src/core/library.lua
+++ b/server/src/core/library.lua
@@ -144,6 +144,24 @@ local function fix(libs)
end
end
+local function scan(path)
+ local result = {path}
+ local i = 0
+ return function ()
+ i = i + 1
+ local current = result[i]
+ if not current then
+ return nil
+ end
+ if fs.is_directory(current) then
+ for path in current:list_directory() do
+ result[#result+1] = path
+ end
+ end
+ return current
+ end
+end
+
local function init()
local lang = require 'language'
local id = lang.id
@@ -152,7 +170,7 @@ local function init()
library = table.container(),
object = table.container(),
}
- for path in io.scan(ROOT / 'libs') do
+ for path in scan(ROOT / 'libs') do
local libs
local buf = io.load(path)
if buf then