Skip to content
mba105 edited this page Sep 24, 2014 · 3 revisions

Home > [Scripting Reference](Scripting Reference) > newoption


newoption

The newoption function registers a new command-line option argument. For more information, see [Command Line Arguments](Command Line Arguments).

#!lua
newoption (description)

Parameters

description is a table describing the new option. It may contain the following fields:

trigger The string identifier of the option; what the user would type on the command line.
description A short description of the option, to be displayed in the help text.
value Optional. If the option needs a value, provides a hint to the user what type of data is expected.
allowed Optional. A list of key-value pairs listing the allowed values for the option.

See Also

[Command Line Arguments](Command Line Arguments)

Examples

Register a new option to select a rendering API for a 3D application.

#!lua
newoption {
   trigger     = "gfxapi",
   value       = "API",
   description = "Choose a particular 3D API for rendering",
   allowed = {
      { "opengl",    "OpenGL" },
      { "direct3d",  "Direct3D (Windows only)" },
      { "software",  "Software Renderer" }
   }
}
Clone this wiki locally