# Lua Writer

The Lua writer generates LuaJIT FFI binding files from headerkit IR. The
output wraps C declarations inside `ffi.cdef[[ ... ]]` blocks and handles
structs, unions, enums, functions, typedefs, constants, and variables.
Non-integer constants (floats, strings) are emitted as Lua local variables
outside the cdef block.

## Writer Class

::: headerkit.writers.lua.LuaWriter
    options:
      show_source: false

## Convenience Function

::: headerkit.writers.lua.header_to_lua
    options:
      show_source: false

## Example

```python
from headerkit.backends import get_backend
from headerkit.writers import get_writer

backend = get_backend()
header = backend.parse("""
typedef struct {
    int x;
    int y;
} Point;

int distance(const Point* a, const Point* b);
""", "geometry.h")

writer = get_writer("lua")
print(writer.write(header))
```

Output:

```lua
-- Auto-generated LuaJIT FFI bindings
-- Source: geometry.h
-- Generated by headerkit

local ffi = require("ffi")

ffi.cdef[[

/* Structs */
typedef struct {
    int x;
    int y;
} Point;

/* Functions */
int distance(const Point *a, const Point *b);

]]

return {}
```
