Documentation
¶
Overview ¶
Package luadata converts Lua data files to JSON using a Rust shared library via purego.
This package provides a pure-Go interface (no CGO required) by loading a platform-specific Rust shared library at runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileToJSON ¶
FileToJSON parses a Lua data file and returns JSON as an io.Reader.
func ReaderToJSON ¶
ReaderToJSON parses Lua data from an io.Reader and returns JSON as an io.Reader.
func TextToJSON ¶
TextToJSON parses a Lua data string and returns the JSON as an io.Reader.
Types ¶
type Option ¶
type Option func(*optionsConfig)
Option configures conversion behavior.
func WithArrayMode ¶
WithArrayMode sets the array detection mode for JSON output. Valid values: "none", "index-only", "sparse" (default). For sparse mode, use WithArrayMaxGap to set the gap threshold.
func WithEmptyTableMode ¶
WithEmptyTableMode sets how empty Lua tables ({}) are rendered in JSON output. Valid values: "null" (default), "omit", "array", "object".
func WithSchema ¶ added in v0.1.15
WithSchema sets a JSON Schema to guide parsing. The schema is a standard JSON Schema string (subset: type, properties, items, format).
func WithStringTransform ¶
WithStringTransform configures how long strings are handled. Strings exceeding maxLen are transformed according to mode. Valid modes: "truncate" (default), "empty", "redact", "replace". For "replace" mode, pass the replacement string.
func WithUnknownFieldMode ¶ added in v0.1.15
WithUnknownFieldMode sets how fields not in the schema are handled. Valid values: "ignore" (default), "include", "fail".