eof
This commit is contained in:
parent
1ac594f195
commit
8bb3b8ab65
38
src/main.rs
38
src/main.rs
@ -161,6 +161,44 @@ fn bake(script_path:std::path::PathBuf)->Result<(),anyhow::Error>{
|
||||
globals.set("script",script_table)?;
|
||||
}
|
||||
|
||||
//shared.require("ContentDatabase").getAttachmentSet(attachset, gunData):modify(Label1,Label2,table)
|
||||
{
|
||||
let shared_table=lua.create_table()?;
|
||||
|
||||
//require
|
||||
shared_table.raw_set("require",
|
||||
lua.create_function(|ctx,_name:String|{
|
||||
let content_database=ctx.create_table()?;
|
||||
|
||||
content_database.raw_set("getAttachmentSet",
|
||||
ctx.create_function(|ctx,(_label1,_label2):(mlua::Table,mlua::Table)|{
|
||||
let attachments=ctx.create_table()?;
|
||||
|
||||
attachments.raw_set("modify",
|
||||
ctx.create_function(|_ctx,(_,label1,label2,data):(mlua::Table,String,String,mlua::Table)|{
|
||||
println!("modify {label1} {label2} {data:?}");
|
||||
Ok(())
|
||||
})?
|
||||
)?;
|
||||
|
||||
attachments.raw_set("modifyall",
|
||||
ctx.create_function(|_ctx,(_,label1,data):(mlua::Table,String,mlua::Table)|{
|
||||
println!("modifyall {label1} {data:?}");
|
||||
Ok(())
|
||||
})?
|
||||
)?;
|
||||
|
||||
Ok(attachments)
|
||||
})?
|
||||
)?;
|
||||
|
||||
Ok(content_database)
|
||||
})?
|
||||
)?;
|
||||
|
||||
globals.set("shared",shared_table)?;
|
||||
}
|
||||
|
||||
match lua.load(script).exec(){
|
||||
Ok(())=>(),
|
||||
Err(e)=>println!("Lua Error: {e}"),
|
||||
|
Loading…
Reference in New Issue
Block a user