Setting pivot coordinates in Lua api

I’m trying to duplicate currently selected layer 37 times and rotating it each time. I want to set the pivot coordinates before rotation but I can’t find anything about that in the api docs. Is it possible to do it?

Here’s what I currently have:

local sprite = app.activeSprite
if not sprite then
    return app.alert("No active sprite.")
end

local repeats = 37

local center = Point(sprite.width // 2, sprite.height // 2)
local angleStep = "9.75"

app.transaction(function()
    for i = 1, repeats do
        app.command.Copy()
        app.command.Paste()
        app.command.Rotate { ui = false, target = "mask", angle = angleStep }
    end
end)

app.refresh()

version: v1.3.15.5-dev

Hey i just get here.
I don’t have much experience on lua but rotate by calculation might work.

local c = app.layer.cel

--loop through pixel

local x, y = Your pixel position on image

local absolute_X = c.bounds.width - c.bounds.x + x
local absolute_Y = c.bounds.height - c.bounds.y + y

local Pivot_vectX = absolute_X - Your_Pivot_Position_X
local Pivot_vectY = absolute_Y - Your_Pivot_Position_Y

local r = math.rad(Your_Degree)

local u = (Pivot_vectX * math.cos(r)) + (Pivot_vectY * math.sin(r))
local v = (Pivot_vectX * -math.sin(r)) + (Pivot_vectY * math.cos(r))

local rotated_pixel_position_X = math.floor(u)
local rotated_pixel_position_Y = math.floor(v)

--draw a pixel in new rotated position

I not sure if I still got my formula right, but you(might) get the idea.