minetest-i4/i4/tests/test_tabs.lua

51 lines
874 B
Lua
Raw Permalink Normal View History

local SWITCH
i3.new_tab("test1", {
2021-01-21 12:28:54 -06:00
description = "Test 1 Test 1",
2021-01-15 18:46:26 -06:00
image = "i3_heart.png",
formspec = function(player, data, fs)
fs("button", 3, 4, 3, 0.8, "test", "Click here")
2022-11-12 12:40:06 -06: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-15 18:46:26 -06:00
end,
fields = function(player, data, fields)
if fields.test then
SWITCH = true
end
end
})
2021-01-15 18:46:26 -06:00
i3.new_tab("test2", {
2021-01-15 18:46:26 -06:00
description = "Test 2",
image = "i3_mesepick.png",
slots = true,
2021-01-15 18:46:26 -06:00
formspec = function(player, data, fs)
fs("label[3,1;Test 2]")
end,
})
2021-01-15 18:46:26 -06:00
2022-03-20 18:06:51 -05:00
i3.new_tab("test_creative", {
description = "Test creative",
2021-01-15 18:46:26 -06:00
access = function(player, data)
local name = player:get_player_name()
2022-03-20 18:06:51 -05:00
return core.is_creative_enabled(name)
2021-01-15 18:46:26 -06:00
end,
formspec = function(player, data, fs)
2022-03-20 18:06:51 -05:00
fs("label[3,1;Creative enabled]")
2021-01-15 18:46:26 -06:00
end,
2022-03-20 18:06:51 -05:00
fields = i3.set_fs,
})
2021-01-28 14:00:08 -06:00