pasta_lua/lib.rs
1//! Pasta Lua - Lua integration for Pasta DSL
2//!
3//! This crate provides a Lua transpiler for Pasta DSL, converting Pasta AST
4//! to Lua source code. It follows the same architecture as pasta_rune but
5//! targets Lua 5.3+ instead of Rune VM.
6//!
7//! # Architecture
8//!
9//! - `LuaTranspiler`: Main transpiler interface
10//! - `LuaCodeGenerator`: Generates Lua code from AST nodes
11//! - `StringLiteralizer`: Converts strings to optimal Lua literal format
12//! - `TranspileContext`: Manages state during transpilation
13//! - `TranspilerConfig`: Configuration options
14//! - `PastaLuaRuntime`: Lua VM host with pasta module integration
15//!
16//! # Example
17//!
18//! ```rust,ignore
19//! use pasta_lua::{LuaTranspiler, TranspilerConfig, PastaLuaRuntime};
20//!
21//! let transpiler = LuaTranspiler::default();
22//! let mut output = Vec::new();
23//!
24//! let context = transpiler.transpile(&actors, &scenes, &mut output)?;
25//! let lua_code = String::from_utf8(output)?;
26//!
27//! // Create runtime with the context
28//! let runtime = PastaLuaRuntime::new(context)?;
29//! runtime.exec(&lua_code)?;
30//! ```
31
32pub mod code_gen;
33pub mod config;
34pub mod context;
35pub mod encoding;
36pub mod error;
37pub mod loader;
38pub mod logging;
39pub mod normalize;
40pub mod runtime;
41pub mod sakura_script;
42pub mod search;
43pub mod string_literalizer;
44pub mod transpiler;
45
46// Re-export main types
47pub use code_gen::LuaCodeGenerator;
48pub use config::{LineEnding, TranspilerConfig};
49pub use context::TranspileContext;
50pub use encoding::{Encoder, Encoding};
51pub use error::{ConfigError, TranspileError};
52pub use loader::{
53 CacheManager, LoaderConfig, LoaderContext, LoaderError, LoggingConfig, LuaConfig, PastaConfig,
54 PastaLoader, TalkConfig, TranspileFailure, TranspileResult, default_libs,
55};
56pub use logging::{
57 GlobalLoggerRegistry, LoadDirGuard, PastaLogger, get_current_load_dir,
58 init_tracing_with_reload, set_current_load_dir, update_tracing_filter,
59};
60pub use runtime::{PastaLuaRuntime, RuntimeConfig};
61pub use search::{SearchContext, SearchError};
62pub use string_literalizer::StringLiteralizer;
63
64// Re-export mlua types needed by pasta_shiori
65pub use mlua;
66pub use transpiler::LuaTranspiler;