[][src]Crate tealr

tealr

A wrapper around rlua to help with embedding teal

tealr adds some traits that replace/extend those from rlua, allowing it to generate the .d.tl files needed for teal.

It also contains some macro's to make it easier to load/execute teal scripts. Without having to compile them yourself first.

Small example type generation

#[derive(Clone,Copy,TealDerive)]
struct Example {}
impl TealData for Example {
}
fn main() -> Result<()> {
    let file_contents = TypeWalker::new()
        .proccess_type::<Example>()
        .generate_global("test")
        .expect("oh no :(");
    //save the file
    println!("{}\n ", file_contents);
    Ok(())
}

Compile inline teal code to lua at the same time as your rust code

let lua_code = compile_inline_teal!("-- your teal code");

Embed the teal compiler, allowing you to run external teal files the same way as external lua files.

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

You can find longer ones here which also go over on how to use the generated lua code.

Future plans

Tealr can already help with 2 ways to run teal scripts

It can compile inline teal code at the same time as your rust code

It can also embed the teal compiler for you, allowing you to execute external teal scripts like normal lua scripts.

There is a third method I want tealr to help with. In this mode, it will compile a teal project, pack it into 1 file and embed it into the project.

Macros

compile_inline_teal

Compiles the given teal code at compile time to lua.

embed_compiler

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

Structs

TealType

Represents a type

TypeWalker

This generates the .d.tl files

TypedFunction

A typed wrapper around rlua::Function

UserDataWrapper

Used to turn UserDataMethods into TealDataMethods.

Traits

TealData

This is the teal version of UserData.

TealDataMethods

The teal version of UserDataMethods

TealMultiValue

A collection of TealValues.

TypeRepresentation

A trait to collect the required type information like the name of the type.

UserData

Trait for custom userdata types.

Derive Macros

TealDerive

Implement both UserData and TypeRepresentation.

TypeRepresentation

Implements TypeRepresentation.

UserData

Implements UserData.