actix-lua 0.1.0

Define Actix actor with Lua
Documentation

Actix-Lua

Actix actor with Lua.

Features

  • Handling messages with Lua
  • Dynamic message type

Usage

Add actix-lua to your Cargo.toml:

[dependencies]
actix-lua = "0.1"

Implement an Actor

You can define an actor with Lua, for example:

extern crate actix_lua;
use actix_lua::{LuaActor, LuaMessage};

fn main () {
    let system = System::new("test");
    let addr = LuaActor::new(r#"
      function handle(msg)
        return msg + 42
      end
    "#).unwrap().start();

    let res = add.send(LuaMessage:from(123));
}

Message Type

LuaActor only accept messages with type LuaMessage. The result of LuaMessage is also LuaMessage.

LuaMessage is defined as:

pub enum LuaMessage {
    String(String),
    Integer(i64),
    Number(f64),
    Boolean(bool),
    Nil,
}

It's the sender's job to check the returned value type from Lua is what they want.

License

The MIT License