Lua API: every module and type
Lua API reference
Everything a PrusaSlicer plugin can call: the api module, the values it hands back and the tables it takes.
A first plugin
A plugin is one Lua file with an info table and an execute function. This one asks for a size and adds a cube of it to the project. Write your first plugin walks through it.
cube.lua
info = {
id = "com.example.cube",
type = "project.plugin",
title = "Cube",
menu = "Examples/Cube",
params = {
{ name = "size", label = "Size [mm]", type = "float", default = 20 },
},
}
function execute(params)
local cube = api.make_cube(params.size, params.size, params.size)
api.project:add_object({ mesh = cube })
endModules
Classes
Values the API gives your plugin, and the tables you build to pass to it.
BedInstRefprinter_config(), printer_presets(), print_presets(), tool_print_presets(), material_presets()5 methodsBoundingBoxmin_x, max_x, min_y, max_y, min_z, max_z6 fieldsConfigBoxvalue(), set()2 methodsEmbossTextOptsfont, text, depth, line_height4 fieldsFloatOrPercentageget_abs_value()1 field · 1 methodFontDescriptorname1 fieldHwPrinterConfigname, tool_count, tools3 fieldsHwToolConfigfeature(), nozzle_diameter()2 methodsMeshtranslate(), bounds()2 methodsModelElementtype1 fieldObjectDefinition: VolumeDefinitionobject_params, other_volumes2 fieldsProjectApiadd_object(), insert_layer_custom_gcode(), clear_layer_custom_steps(), current_bed()4 methodsVector3Shapex, y, z3 fieldsVolumeDefinitionmesh, translate, rotate, type, params5 fieldsEnums
Globals
Names every plugin file sees without a require.
VolumeTypeVolumeTypeapiapiIn your editor
The same API ships as annotated Lua stubs. Point your editor's Lua language server at them for completion, hover docs and type checks; an AI agent can read them too.Set up your editor.
Download the stubs for 1.0.0