Implementation:Alibaba MNN FlatBuffers IDL Gen Lua
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Code_Generation |
| Last Updated | 2026-02-10 12:00 GMT |
Overview
Lua code generator backend that produces FlatBuffers accessor modules for the Lua scripting language.
Description
idl_gen_lua.cpp implements the Lua code generation backend for flatc. It generates Lua modules containing table-based accessor objects that read FlatBuffer binary data through string byte operations. The generated code follows Lua module conventions and depends on the FlatBuffers Lua runtime library for buffer manipulation and builder functionality.
Usage
Vendored dependency used internally by MNN for model serialization. Not directly imported by end users.
Code Reference
Source Location
- Repository: Alibaba_MNN
- File:
3rd_party/flatbuffers/src/idl_gen_lua.cpp - Lines: 1-729
Signature
namespace flatbuffers {
bool GenerateLua(const Parser &parser,
const std::string &path,
const std::string &file_name);
}
Import
#include "flatbuffers/idl.h"
// Generator invoked internally by flatc
I/O Contract
| Input | Output |
|---|---|
| Parsed Parser object with schema definitions | *.lua Lua module files (one per namespace)
|
Usage Examples
// Invoked by flatc:
// flatc --lua schema.fbs
// Internally:
flatbuffers::Parser parser;
parser.Parse(schema);
flatbuffers::GenerateLua(parser, output_path, file_name);
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment