basic Lua 5.4 implementation with few example commands
This commit is contained in:
parent
11c2500d9c
commit
7440baa1b2
35 changed files with 2554 additions and 460 deletions
28
crates/jarvis-core/src/lua.rs
Normal file
28
crates/jarvis-core/src/lua.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
mod engine;
|
||||
mod sandbox;
|
||||
mod error;
|
||||
mod api;
|
||||
|
||||
mod structs;
|
||||
pub use structs::*;
|
||||
|
||||
pub use engine::LuaEngine;
|
||||
pub use sandbox::SandboxLevel;
|
||||
pub use error::LuaError;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
// Execute a Lua command script
|
||||
pub fn execute(
|
||||
script_path: &PathBuf,
|
||||
context: CommandContext,
|
||||
sandbox: SandboxLevel,
|
||||
timeout: Duration,
|
||||
) -> Result<CommandResult, LuaError> {
|
||||
let engine = LuaEngine::new(sandbox)?;
|
||||
engine.execute(script_path, context, timeout)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue