Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate chunk!'s content #439

Open
liketoeatcheese opened this issue Aug 17, 2024 · 0 comments
Open

Separate chunk!'s content #439

liketoeatcheese opened this issue Aug 17, 2024 · 0 comments

Comments

@liketoeatcheese
Copy link

fn main() {
    let lua = unsafe { Lua::unsafe_new() };
    let helloworld = "test";
    let _ = lua.load(chunk!{
        print($helloworld)
    });
}

Hi I'm wondering is there a way to separate chunk! content to a separate variable and pass it in? Below is wrong since chunk! will use it as a rust variable but just to describe what I mean.

fn main() {
    let lua = unsafe { Lua::unsafe_new() };
    let helloworld = "test";
    let lua_code = "print($helloworld)";
    let _ = lua.load(chunk!{
       $lua_code
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant