i3/tests/test_tabs.lua

51 lines
874 B
Lua
Raw Normal View History

local SWITCH
i3.new_tab("test1", {
2021-01-21 19:28:54 +01:00
description = "Test 1 Test 1",
2021-01-16 01:46:26 +01:00
image = "i3_heart.png",
formspec = function(player, data, fs)
fs("button", 3, 4, 3, 0.8, "test", "Click here")
2022-11-12 19:40:06 +01:00
fs("label", 3, 1, "Just a test")
if SWITCH then
fs"label[3,2;Button clicked]"
else
fs"label[3,2;Lorem Ipsum]"
end
2021-01-16 01:46:26 +01:00
end,
fields = function(player, data, fields)
if fields.test then
SWITCH = true
end
end
})
2021-01-16 01:46:26 +01:00
i3.new_tab("test2", {
2021-01-16 01:46:26 +01:00
description = "Test 2",
image = "i3_mesepick.png",
slots = true,
2021-01-16 01:46:26 +01:00
formspec = function(player, data, fs)
fs("label[3,1;Test 2]")
end,
})
2021-01-16 01:46:26 +01:00
2022-03-21 00:06:51 +01:00
i3.new_tab("test_creative", {
description = "Test creative",
2021-01-16 01:46:26 +01:00
access = function(player, data)
local name = player:get_player_name()
2022-03-21 00:06:51 +01:00
return core.is_creative_enabled(name)
2021-01-16 01:46:26 +01:00
end,
formspec = function(player, data, fs)
2022-03-21 00:06:51 +01:00
fs("label[3,1;Creative enabled]")
2021-01-16 01:46:26 +01:00
end,
2022-03-21 00:06:51 +01:00
fields = i3.set_fs,
})
2021-01-28 21:00:08 +01:00