Created
October 2, 2022 04:51
-
-
Save tonyfast/abc7748fcc84177b59156d156132aabb to your computer and use it in GitHub Desktop.
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
from importnb import Notebook | |
@dataclass | |
class Lua(Notebook): | |
extensions = ".lua", ".lua.ipynb" | |
def exec_module(self, module): | |
from lupa import LuaRuntime | |
module.lua = LuaRuntime() | |
module.lua.execute(self.get_source(self.path)) | |
globs = module.lua.globals() | |
module.__dict__.update(zip(globs.keys(), globs.values())) | |
return module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment