You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
446 B
18 lines
446 B
1 month ago
|
local lazy = {}
|
||
|
|
||
|
--- Require on index.
|
||
|
---
|
||
|
--- Will only require the module after the first index of a module.
|
||
|
--- Only works for modules that export a table.
|
||
|
---@param require_path string
|
||
|
---@return table
|
||
|
lazy.require = function(require_path)
|
||
|
return setmetatable({}, {
|
||
|
__index = function(_, key) return require(require_path)[key] end,
|
||
|
|
||
|
__newindex = function(_, key, value) require(require_path)[key] = value end,
|
||
|
})
|
||
|
end
|
||
|
|
||
|
return lazy
|