#networking #lua #api-bindings

mlua-socket

A Rust-native implementation of LuaSocket for mlua

18 releases

Uses new Rust 2024

new 0.2.7 Feb 17, 2026
0.2.6 Sep 27, 2025
0.2.5 Aug 8, 2025
0.2.4 Jul 29, 2025
0.1.2 Nov 19, 2023

#724 in Network programming

Download history 26/week @ 2025-10-23 2/week @ 2025-10-30 19/week @ 2025-11-06 4/week @ 2025-11-13 5/week @ 2025-11-27 16/week @ 2025-12-25 198/week @ 2026-01-01 6/week @ 2026-01-08 16/week @ 2026-01-15 7/week @ 2026-01-22 110/week @ 2026-01-29 99/week @ 2026-02-05

232 downloads per month

MIT license

1.5MB
3K SLoC

Rust 2K SLoC // 0.0% comments Lua 1K SLoC // 0.2% comments

mlua-socket

A Rust-native implementation of LuaSocket for mlua.

License Arch Lua

Installing

Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].

$ cargo add mlua-socket --features luajit

Testing

$ make check

Benchmarking

$ make bench

Using

use mlua::Lua;

let lua = Lua::new();
mlua_socket::preload(&lua);
let script = r#"
    local socket = require('socket')
    local client = socket.connect('127.0.0.1', 3000)
    return client:send('abcd')
"#;
let _last_index: u16 = lua.load(script).eval()?;

Dependencies

~6–24MB
~290K SLoC