TeXipedia

lua-alt-getopt

Provides command-line argument processing functionality for Lua scripts, following the familiar BSD/GNU getopt_long convention.

Overview

Enables standardized command-line argument parsing in Lua applications, offering a familiar interface for developers who work with shell scripts or C programs. The module simplifies the handling of both short and long command-line options.

  • Implements the well-established getopt_long convention from BSD/GNU systems
  • Helps maintain consistency across command-line applications and scripts
  • Particularly useful for Lua scripts that need robust command-line parameter handling
  • Ideal for creating command-line tools and utilities that require professional-grade argument parsing

Getting Started

lua-alt-getopt is a command-line tool for Lua scripts, not a LaTeX package to be loaded with \usepackage.

To use it in your Lua scripts:

local alt_getopt = require "alt_getopt"

-- Example usage
local long_opts = {help = "h", output = 1}
local opts, optind, optarg = alt_getopt.get_opts(arg, "ho:", long_opts)

This module helps Lua scripts process command-line arguments in the same way as BSD/GNU getopt_long functions.