Skip to main content


Registers a new command-line action argument. For more information, see Command Line Arguments.

newaction { description }


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

triggerWhat the user would type on the command line to select the action, e.g. "vs2013".
shortnameA short summary for the help text, e.g. "Visual Studio 2013".
descriptionA description of the action's result, e.g. "Generate Visual Studio 2013 project files".
executeA function to be executed when the action is fired.
targetosIf the toolset targets a specific OS, the identifier for that OS.
valid_kindsThe list of project kinds supported by the action.
valid_languagesThe list of languages supported by the action.
valid_toolsThe list of tools supported by the action.
toolsetDefault tools.
onStartA callback marking the start of action processing.
onWorkspaceA callback for each workspace specified in the user script.
onProjectA callback for each project specified in the user script.
onRuleA callback for each rule specified in the user script.
onEndA callback marking the end of action processing.
onCleanWorkspaceA callback for each workspace, when the clean action is selected.
onCleanProjectA callback for each project, when the clean action is selected.
onCleanTargetA callback for each target, when the clean action is selected.
pathVarsA map of Premake tokens to toolset specific identifiers.

The callbacks will fire in this order:

  1. onStart() 2a. onWorkspace() for each workspace 2b. onProject() for each project in each workspace
  2. onRule() for each rule
  3. execute()
  4. onEnd()

The following fields have been deprecated:

osDeprecated, use targetos instead.
onSolutionDeprecated, use onWorkspace instead.


Premake 5.0 and later.


Register a new action to install the software project.

newaction {
trigger = "install",
description = "Install the software",
execute = function ()
os.copyfile("bin/debug/myprogram", "/usr/local/bin/myprogram")

See Also