Nift - lua
Contents
Syntax
The syntax for lua calls is:
f++
:
lua{options}(file-path)
lua{options}
{
-- block of Lua code
}
n++
:
@lua{options}(file-path)
@lua{options}
{
-- block of Lua code
}
Description
The lua function is for running Lua code, it takes zero parameters with the call followed by a block of Lua code otherwise a single parameter that should be a file-path to Lua code to run. See here for more information about Lua.
Options
The following options are available for lua calls:
| option | description |
|---|---|
| !o | do not return result |
| o | return result |
| pb | parse block with language call is made from before running code with Lua |
| option | description |
f++ example
Examples of lua being used with f++:
lua
{
local vips = require "vips"
local image = vips.Image.new_from_file("logo.png")
image:resize(0.5):webpsave("logo.webp")
}
n++ example
Example of lua being used with n++:
@lua
{
local vips = require "vips"
local image = vips.Image.new_from_file("logo.png")
image:resize(0.5):webpsave("logo.webp")
}