Lua Script
Lua Script is an Azure DevOps Extension that provides a task for executing a Lua script.
It is possible to:
- execute a given Lua file, optionally with arguments
- execute inline Lua code
Agent Specification
✅ windows-latest
✅ macos-latest
✅ ubuntu-latest
Usage
File
steps:
- task: Lua@0
displayName: 'Execute Lua Script'
inputs:
target: file
path: test.lua
args: arg1 2023 arg3
Inline
steps:
- task: Lua@0
displayName: 'Execute Lua Script'
inputs:
target: inline
script: |
local function read_file(path)
local file = assert(io.open(path, "r"))
local contents = assert(file:read("a"))
file:close()
return contents
end
print(read_file("test.txt"))
Parameter |
Aliases |
Required |
Description |
arguments |
args |
false |
The arguments that can be passed to a given Lua file Optional if targetType = file |
filePath |
path |
false |
The path of the Lua file to execute Required if targetType = file |
script |
|
false |
The inline script to execute Required if targetType = inline |
targetType |
target |
false |
The target type Options: file, inline Default: file |
Notes
Installing Lua is not part of this extension.
Furthermore, the task requires the use of the lua
command.
Thus, you are responsible for the Lua installation and that the lua
command can be accessed.
The following section describes how to install Lua on Ubuntu.
Something like this is necessary if you use a Microsoft-Hosted Pipeline, because Lua is not installed by default.
Ubuntu Installation
steps:
- script: sudo apt-get install lua5.4
displayName: 'Install Lua'
Main Dependencies
Credits