Formspec: new method imageButtonRow
This commit is contained in:
@@ -745,6 +745,41 @@ function Formspec:imageButton(x, y, w, h, textureName, name, label, pressedTextu
|
||||
return self
|
||||
end
|
||||
|
||||
---@alias Formspec.ImageButtonRowElement {
|
||||
--- [1] : string,
|
||||
--- [2] : string,
|
||||
--- [3] : string?,
|
||||
--- [4] : string?,
|
||||
--- [5] : boolean?,
|
||||
--- [6] : boolean?,
|
||||
--- }
|
||||
|
||||
---Creates a row of buttons, automatically calculating the coordinates of buttons based on the width.
|
||||
---
|
||||
---@see Formspec.imageButton
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param w number
|
||||
---@param h number
|
||||
---@param imageButtonRow Formspec.ImageButtonRowElement[]
|
||||
---@return Formspec
|
||||
function Formspec:imageButtonRow(x, y, w, h, imageButtonRow)
|
||||
---@param element Formspec.ImageButtonRowElement
|
||||
for i, element in ipairs(imageButtonRow) do
|
||||
local ex = x + ( ( i - 1 ) * w)
|
||||
self:imageButton(ex, y, w, h,
|
||||
element[1],
|
||||
element[2],
|
||||
element[3],
|
||||
element[4],
|
||||
element[5],
|
||||
element[6]
|
||||
)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
---Clickable item image button. When clicked, fields will be sent.
|
||||
---
|
||||
---**Element:** `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
|
||||
|
||||
Reference in New Issue
Block a user