2022-01-04 23:15:17 +08:00
|
|
|
--=============================================================================
|
|
|
|
-- api.lua --- lua api plugin
|
2023-03-26 13:50:22 +08:00
|
|
|
-- Copyright (c) 2016-2023 Wang Shidong & Contributors
|
2022-01-04 23:15:17 +08:00
|
|
|
-- Author: Wang Shidong < wsdjeg@outlook.com >
|
|
|
|
-- URL: https://spacevim.org
|
|
|
|
-- License: GPLv3
|
|
|
|
--=============================================================================
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
2022-09-25 19:12:46 +08:00
|
|
|
|
|
|
|
-- local logger = require('spacevim.logger')
|
|
|
|
|
2022-01-04 23:15:17 +08:00
|
|
|
function M.import(name)
|
2022-10-07 13:55:29 +08:00
|
|
|
local p = 'spacevim.api.' .. name
|
|
|
|
local ok, rst = pcall(require, p)
|
2022-09-25 19:12:46 +08:00
|
|
|
if ok then
|
2022-10-07 13:55:29 +08:00
|
|
|
package.loaded[p] = nil
|
2022-09-25 19:12:46 +08:00
|
|
|
return rst
|
2022-10-07 13:55:29 +08:00
|
|
|
else
|
|
|
|
return nil
|
2022-09-25 19:12:46 +08:00
|
|
|
end
|
2019-05-31 21:45:09 +08:00
|
|
|
end
|
|
|
|
|
2022-01-04 23:15:17 +08:00
|
|
|
return M
|