[][src]Macro tealr::embed_compiler

embed_compiler!() { /* proc-macro */ }

Embeds the teal compiler, making it easy to load teal files directly.

It does so by downloading the given version of the teal compiler from github Compiling it without the lua5.3 compatibility library and embedding it into your application.

It returns a closure that takes the file that needs to run and returns valid lua code that both prepares the lua vm so it can run teal files and loads the given file using require, returning the result of the file that got loaded.

NOTE!

Due to how the teal files are being loaded, they won't be typed checked. More info on: https://github.com/teal-language/tl/blob/master/docs/tutorial.md (Search for "loader")

Compile time requirement!

This needs to be able to run lua at compile time to compile the teal compiler. ##Example

 let compiler = embed_compiler!("v0.9.0");
 let lua_code = compiler("your_teal_file.tl");