API: Add field to toggle slots in custom tabs

This commit is contained in:
Jean-Patrick Guerrero
2023-02-01 02:44:14 +01:00
parent 7a4f352ce4
commit b31e7a48ab
7 changed files with 100 additions and 69 deletions

View File

@ -1,16 +1,32 @@
local SWITCH
i3.new_tab("test1", {
description = "Test 1 Test 1",
image = "i3_heart.png",
formspec = function(player, data, fs)
fs("button", 3, 4, 3, 0.8, "test", "Click here")
fs("label", 3, 1, "Just a test")
fs"label[3,2;Lorem Ipsum]"
if SWITCH then
fs"label[3,2;Button clicked]"
else
fs"label[3,2;Lorem Ipsum]"
end
end,
fields = function(player, data, fields)
if fields.test then
SWITCH = true
end
end
})
i3.new_tab("test2", {
description = "Test 2",
image = "i3_mesepick.png",
slots = true,
formspec = function(player, data, fs)
fs("label[3,1;Test 2]")