Created
April 6, 2024 20:18
-
-
Save itsfrank/c3e193338612eb00324dc2340aaffa79 to your computer and use it in GitHub Desktop.
Temporary workaround for lune issue with module caching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this file is only necessary because lune currently does not cache modules properly | |
-- see: https://github.com/lune-org/lune/issues/138 | |
if _G._modulestate == nil then | |
_G._modulestate = {} | |
end | |
local modulestate = {} | |
-- if the state has not been initialized yet, we will use init to set values | |
function modulestate.get_state(s: string, init: { [any]: any }?): { [any]: any } | |
if _G._modulestate[s] == nil then | |
_G._modulestate[s] = {} | |
if init ~= nil then | |
for k, v in pairs(init) do | |
_G._modulestate[s][k] = v | |
end | |
end | |
end | |
return _G._modulestate[s] | |
end | |
return modulestate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment