# tencent/xlua

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tencent-xlua).**

10,101 stars · 2,498 forks · C · NOASSERTION

## Links

- GitHub: https://github.com/Tencent/xLua
- awesome-repositories: https://awesome-repositories.com/repository/tencent-xlua.md

## Topics

`csharp` `lua` `unity` `unity3d` `xlua`

## Description

xLua is a scripting bridge and C++ wrapper used to embed the Lua language into host applications. It facilitates bidirectional data exchange and function calls between scripts and the host environment.

The project includes a runtime patching tool for replacing application logic and fixing bugs without requiring a system restart. It features a coroutine orchestrator that wraps asynchronous operations into linear code and a script validator that verifies digital signatures to ensure code authenticity and integrity before execution.

To minimize memory overhead and garbage collection, the system supports passing custom structures and enums via direct memory layout mapping. It further provides mechanisms for static type mapping and the synchronization of asynchronous logic.

## Tags

### Programming Languages & Runtimes

- [Embedded Scripting Engines](https://awesome-repositories.com/f/programming-languages-runtimes/embedded-scripting-engines.md) — Provides a comprehensive bridge for embedding the Lua scripting language into host applications for bidirectional data exchange. ([source](https://cdn.jsdelivr.net/gh/tencent/xlua@master/README.md))
- [C Function Bindings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/c-function-bindings.md) — Interfaces the host language with Lua using a low-level C bridge for bidirectional function calls and data exchange.
- [Language Wrappers](https://awesome-repositories.com/f/programming-languages-runtimes/language-wrappers.md) — Provides a C++ wrapper that allows host applications to call Lua functions and pass custom C structures.
- [Lua](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/dynamic-scripting-languages/lua.md) — Integrates a Lua interpreter into a host application to allow dynamic data exchange and function calls.
- [Coroutine Orchestrators](https://awesome-repositories.com/f/programming-languages-runtimes/coroutine-orchestrators.md) — Provides a system for wrapping asynchronous operations into linear code using Lua cooperative multitasking routines.

### Part of an Awesome List

- [GC Reduction Strategies](https://awesome-repositories.com/f/awesome-lists/devtools/memory-allocation/gc-reduction-strategies.md) — Supports passing custom structs and enums between the scripting engine and host environment to reduce garbage collection overhead. ([source](https://cdn.jsdelivr.net/gh/tencent/xlua@master/README.md))
- [Scripting and Interop](https://awesome-repositories.com/f/awesome-lists/devtools/scripting-and-interop.md) — Serves as a bridge for embedding the Lua scripting language into applications to facilitate data exchange and function calls.

### Data & Databases

- [Direct Memory Data Transfer](https://awesome-repositories.com/f/data-databases/shared-memory-data-exchange/direct-memory-data-transfer.md) — Passes complex data structures via raw memory pointers to avoid expensive object allocation and garbage collection overhead.
- [Script-to-Native Type Mappings](https://awesome-repositories.com/f/data-databases/type-mapping-frameworks/script-to-native-type-mappings.md) — Maps host-side types to Lua environments through a predefined registry to ensure consistent data representation.

### Development Tools & Productivity

- [Hot-Patching Tools](https://awesome-repositories.com/f/development-tools-productivity/hot-patching-tools.md) — Enables replacing application logic and fixing bugs at runtime using Lua scripts without requiring a system restart.
- [Script Validators](https://awesome-repositories.com/f/development-tools-productivity/script-validators.md) — Ensures the authenticity of executable code by validating digital signatures before scripts are loaded.
- [Asynchronous](https://awesome-repositories.com/f/development-tools-productivity/task-schedulers/asynchronous.md) — Allows non-blocking code to be written in a linear style by wrapping asynchronous operations using cooperative multitasking. ([source](https://cdn.jsdelivr.net/gh/tencent/xlua@master/README.md))

### Security & Cryptography

- [Bytecode Validators](https://awesome-repositories.com/f/security-cryptography/identity-access-management/access-control/digital-signature-validators/bytecode-validators.md) — Verifies the integrity of pre-compiled scripts by checking digital signatures before the virtual machine executes the bytecode.
- [Signature Verification Tools](https://awesome-repositories.com/f/security-cryptography/signature-verification-tools.md) — Ensures code authenticity and integrity by validating digital signatures on scripts before they are executed. ([source](https://cdn.jsdelivr.net/gh/tencent/xlua@master/README.md))

### Software Engineering & Architecture

- [Runtime Patching Engines](https://awesome-repositories.com/f/software-engineering-architecture/code-patching-engines/patch-generators/runtime-patching-engines.md) — Enables fixing bugs without restarting the system by replacing existing method implementations with scripts during runtime. ([source](https://cdn.jsdelivr.net/gh/tencent/xlua@master/README.md))
- [Scripting Memory Optimizations](https://awesome-repositories.com/f/software-engineering-architecture/high-performance-engineering/scripting-memory-optimizations.md) — Passes custom structs and enums between a host and Lua engine to minimize memory overhead and garbage collection.
- [Runtime Method Patching](https://awesome-repositories.com/f/software-engineering-architecture/runtime-method-patching.md) — Replaces existing host method implementations at runtime by intercepting calls through a dynamic script-based lookup table.

### Web Development

- [Async-to-Sync Wrappers](https://awesome-repositories.com/f/web-development/server-side-frameworks/kotlin-frameworks/async-to-sync-wrappers.md) — Simulates synchronous execution flow for asynchronous tasks by suspending and resuming cooperative multitasking routines.
