Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. hlua

hlua

MITC

A high-level Rust binding for Lua 5.2, enabling safe interaction with Lua variables, functions, and tables.

GitHubGitHub
523 stars49 forks0 contributors

What is hlua?

hlua is a Rust library that provides a high-level binding for Lua 5.2, allowing Rust applications to safely interface with the Lua scripting language. It enables executing Lua code, reading/writing variables, exposing Rust functions, and manipulating Lua tables without direct stack access. The library solves the problem of embedding Lua in Rust with type safety and ergonomic APIs.

Target Audience

Rust developers who need to embed Lua scripting in their applications, such as game developers, tool creators, or those building extensible systems. It's ideal for those who want safe, high-level interaction with Lua without dealing with low-level C APIs.

Value Proposition

Developers choose hlua over lower-level bindings because it offers a safe, idiomatic Rust API that prevents common errors like stack misuse, provides seamless type conversions, and includes features like container support and user data. Its focus on safety without sacrificing functionality makes it a robust choice for embedding Lua.

Overview

Rust library to interface with Lua

Use Cases

Best For

  • Embedding Lua scripting in Rust-based game engines
  • Creating extensible tools or plugins with Lua in Rust
  • Automating tasks by exposing Rust functions to Lua scripts
  • Prototyping game logic with Lua while using Rust for performance
  • Building configuration systems where Lua scripts define behavior
  • Developing modding APIs for Rust applications with Lua support

Not Ideal For

  • Projects requiring Lua 5.3 or higher features for modern scripting capabilities
  • Developers needing low-level access to the Lua stack for custom performance optimizations
  • Applications where binding stability is critical, due to the unstable user data API
  • Teams that require reading sparse or complex Lua tables directly into Rust Vecs without limitations

Pros & Cons

Pros

Type Safety Enforcement

Ensures safe variable access by enforcing Rust types like i32 and bool when reading/writing Lua globals, preventing type mismatches at compile time.

Ergonomic API Abstraction

Abstracts the Lua stack with simple methods like set and get, making it easy to execute Lua code and manipulate tables without low-level details.

Seamless Function Exposure

Allows wrapping Rust functions and closures for Lua calls with compile-time lifetime checks, ensuring memory safety.

Container Integration

Supports reading and writing Rust containers like Vec and HashMap to/from Lua tables, simplifying data exchange between the languages.

Cons

Outdated Lua Binding

Only supports Lua 5.2, lacking features from newer versions like integer division in Lua 5.3, which may hinder adoption in modern projects.

Unstable Advanced APIs

The user data API is marked as 'very unstable' in the README, leading to potential breaking changes and increased maintenance burden for custom types.

Limited Table Reading

Cannot read all Lua tables into Rust Vecs; for example, sparse arrays or non-numeric keys result in None, restricting data handling flexibility.

Potential Performance Cost

High-level abstractions may add overhead compared to direct C bindings, which could be a concern in performance-sensitive applications.

Frequently Asked Questions

Quick Stats

Stars523
Forks49
Contributors0
Open Issues43
Last commit1 year ago
CreatedSince 2014

Tags

#embedded-scripting#ffi#game-development#scripting#rust-library#lua#rust#automation#lua-binding

Built With

R
Rust

Included in

Rust56.6k
Auto-fetched 8 hours ago

Related Projects

RustPythonRustPython

A Python Interpreter written in Rust

Stars22,340
Forks1,484
Last commit20 hours ago
PyO3PyO3

Rust bindings for the Python interpreter

Stars16,116
Forks1,016
Last commit20 hours ago
wasm-bindgenwasm-bindgen

Facilitating high-level interactions between Wasm modules and JavaScript

Stars9,145
Forks1,242
Last commit10 hours ago
NeonNeon

Rust bindings for writing safe and fast native Node.js modules.

Stars8,425
Forks287
Last commit7 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub