actix_lua/lib.rs
1//! # actix-lua: Lua scripting for actix
2//!
3//! The `actix-lua` crate provides a safe [Lua programming language] scripting enviroment for [actix], an actor framework.
4//!
5//! # The `LuaActor` object
6//!
7//! The main type exported by this library is the [`LuaActor`] struct.
8//!
9//! You should create [`LuaActor`] with [`LuaActorBuilder`].
10//!
11//! ```
12//! extern crate actix_lua;
13//! extern crate actix;
14//!
15//! use actix_lua::{LuaActorBuilder};
16//! use actix::Actor;
17//!
18//! let addr = LuaActorBuilder::new()
19//! .on_handle_with_lua(r#"return ctx.msg + 42"#)
20//! .build()
21//! .unwrap()
22//! .start();
23//! ```
24//!
25//! # The `LuaMessage` type
26//!
27//! [`LuaActor`] can only send/receive messages with type [`LuaMessage`].
28//! It can be converted from/to primitive types such as `i64`, `String`, and `HashMap` with `LuaMessage::from`.
29//!
30//! [actix]: https://github.com/actix/actix
31//! [Lua programming language]: https://www.lua.org
32//! [`LuaActor`]: struct.LuaActor.html
33//! [`LuaActorBuilder`]: struct.LuaActorBuilder.html
34//! [`LuaMessage`]: enum.LuaMessage.html
35#[cfg(test)]
36extern crate futures_timer;
37
38mod actor;
39mod builder;
40mod message;
41
42pub use crate::actor::LuaActor;
43pub use crate::builder::LuaActorBuilder;
44pub use crate::message::LuaMessage;
45
46/// Re-export `rlua` interface for library developers
47pub mod dev {
48 pub mod rlua {
49 pub use rlua::*;
50 }
51}