1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Runtime creation and sandboxing.
//!
//! This module provides functions to create sandboxed Lua runtimes and utilities
//! for output capture, documentation registration, and package path management.
//!
//! See [`sandbox`] for the full security model and API specification.
/// Creates a sandboxed Lua runtime.
///
/// Returns a Lua VM with policy-based sandboxing applied. See module-level documentation
/// for details on what's allowed and blocked.
///
/// # Example
///
/// ```
/// use onetool::runtime;
///
/// # fn example() -> mlua::Result<()> {
/// let lua = runtime::default()?;
///
/// // Safe operations work
/// lua.load("x = math.sqrt(16)").exec()?;
///
/// // Unsafe operations return nil (denied by default policy)
/// let result: mlua::Value = lua.load("return io.open('file.txt')").eval()?;
/// assert!(matches!(result, mlua::Value::Nil));
/// # Ok(())
/// # }
/// ```