MCPcopy Create free account
hub / github.com/StrataWM/strata / module

Function module

src/bindings/input/mod.rs:17–32  ·  view source on GitHub ↗
(
	ctx: lua::Context<'gc>,
	comp: Rc<RefCell<StrataComp>>,
)

Source from the content-addressed store, hash-verified

15};
16
17pub fn module<'gc>(
18 ctx: lua::Context<'gc>,
19 comp: Rc<RefCell<StrataComp>>,
20) -> anyhow::Result<lua::Value<'gc>> {
21 let ud = lua::UserData::new_static(&ctx, comp.clone());
22 let meta = lua::Table::new(&ctx);
23
24 let index = lua::Table::new(&ctx);
25 index.set(ctx, "Key", key::module(ctx, comp.clone())?)?;
26 index.set(ctx, "Mod", modflags::module(ctx, comp.clone())?)?;
27
28 meta.set(ctx, lua::MetaMethod::Index, index)?;
29 ud.set_metatable(&ctx, Some(meta));
30
31 Ok(lua::Value::UserData(ud))
32}

Callers 1

registerFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected