README.md

May 22, 2025 ยท View on GitHub

WARNING: THIS IS ALPHA SOFTWARE. USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED AND BUGS ARE EXPECTED.

LuaCEmbed is a Lua wrapper to allow easy interoperability between C and Lua, providing methods to control Lua code from C, create Lua libraries, or set up environments for safe evaluation of Lua code.

Releases

ItemDescription
LuaCEmbedOne.cOne File
LuaCEmbed.cDefinition
LuaCEmbed.hHeader
LuaCEmbed.zipZip Mode

Most Basic Example

Like all OUI libraries, LuaCEmbed adopts the idea of a single-file library, so you just need to copy the LuaCEmbedOne.c file into your project and compile with gcc/clang.

#include "LuaCEmbedOne.c"

int main(int argc, char *argv[]){
    LuaCEmbed *l = newLuaCEmbedEvaluation();
    LuaCEmbed_evaluate(l, "r = 30");
    long calc = LuaCEmbed_get_evaluation_long(l, "r + 20");
    printf("result %ld", calc);
    
    if(LuaCEmbed_has_errors(l)){
        printf("error: %s\n", LuaCEmbed_get_error_message(l));
    }
    LuaCEmbed_free(l);
    return 0;
}

Documentation

ItemDescription
build_and_install.mdInstallation and Compilation
native_functions.mdRunning Native Functions
making_a_library.mdCreating Libraries
evaluations.mdLua Evaluation
timeout.mdTimeout
memory_usage.mdMemory Usage
callbacks.mdCallbacks
table_handling.mdTable Handling
table_setting.mdSetting Table Properties
table_size.mdTable Size
dependencies.mdLicenses and Attributions