example code 2

local panel = ascendify.panel({
	name = "Test Addon",
	size = UDim2.new(0, 320, 0, 300),
	position = UDim2.new(0, 360, 0, 300),
	no_dock = true,
})

local column = ascendify.column(panel.items)
local section = ascendify.section(column, { name = "Test2" })

section:button_holder({})

ascendify.button(section, {
	name = "Print Flag",
	callback = function()
		print(ascendify.get_flag("example_toggle"))
	end
})

ascendify.input(section, {
	name = "Example Input",
	flag = "example_input",
	placeholder = "Type here",
	callback = function(v)
		print("input:", v)
	end
})

local toggle =
	ascendify.toggle(section, {
		name = "Enabled",
		flag = "example_toggle",
		default = false,
		callback = function(v)
			print("toggle:", v)
		end
	})

ascendify.key_picker(toggle, {
	name = "Activation Key",
	flag = "example_key",
	mode = "toggle",
	callback = function(v, k)
		print("key state:", v, k)
	end
})

ascendify.color_picker(toggle, {
	name = "Example Color",
	flag = "example_color",
	callback = function(c, a)
		print("color:", c, a)
	end
})

ascendify.slider(section, {
	name = "Speed",
	flag = "example_speed",
	min = 0,
	max = 100,
	default = 25,
	interval = 1,
	callback = function(v)
		print("speed:", v)
	end
})

ascendify.dropdown(section, {
	name = "Mode",
	flag = "example_mode",
	items = { "A", "B", "C" },
	default = "A",
	callback = function(v)
		print("mode:", v)
	end
})

ascendify.on_unload(function()
	if panel and panel.items and panel.items.sgui then
		panel.items.sgui:Destroy()
	end
end)

Last updated