How to: teal modules in embeded environment #635
Unanswered
barsoosayque
asked this question in
Q&A
Replies: 1 comment 4 replies
-
there should be an I am doing something similar in https://github.com/lenscas/tealr_doc_gen/blob/f9ce06346b0e97a836d36b86f908e5b7bb229953/base_template.etlua#L137 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to embed teal compiler into a rust project to generate lua code in runtime. My current generator is:
I use luajit to run this generator when I'm loading tl files. Isolated scripts are ok, but when script has
require("local_module")
, I don't see a way to include this module sotl.gen
would actually produce code (it just throws an error about an unknown module). Using standalone tl tool to check my scripts return no error, since I have a validtlconfig.lua
file withinclude_dir
pointing to my modules.So my question is: in an environment when I have a chunk of teal code and a bunch of modules from
include_dir
in form of teal code, how do I compile this chunk into a lua code ?(I tried setting
env.modules["mymodule"] = [[ <teal module code> ]]
, it does help with resolving a module, but it doesn't provide global records I defined in that module. My current workaround is to regex replacerequire
s with actual module code, but that's a very limited approach and it make diagnostic messages misleading, since the line number becomes offset)Beta Was this translation helpful? Give feedback.
All reactions