Files
rusty-path-of-building/src/pob/api/clipboard.rs
T
meehl cc6de120f2 Refactor context handling and redraw requests
Remove unsafe pointer shenanigans and give Lua instance ownership over
`Context`. Event handlers now directly mutate Context instead of using a
shared app state which is then hooked up to Context via unsafe pointers.
The removal of a shared state means stages (previously called "modes")
are now responsible for keeping their own internal state.

Additionally, clean up draw request handling and module hierarchy.
2026-08-23 23:55:43 +02:00

14 lines
399 B
Rust

use crate::pob::Context;
use mlua::{Lua, Result as LuaResult};
pub fn copy(l: &Lua, text: String) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
ctx.window_state.set_clipboard_text(text);
Ok(())
}
pub fn paste(l: &Lua, _: ()) -> LuaResult<Option<String>> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
Ok(ctx.window_state.get_clipboard_text())
}