initial
This commit is contained in:
commit
5931cb012f
9 changed files with 900 additions and 0 deletions
17
lua/django/lazy.lua
Normal file
17
lua/django/lazy.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue