Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 859 Bytes

dialogs.md

File metadata and controls

54 lines (42 loc) · 859 Bytes

Dialogs

List Dialog

local items = {
	{ type = "item", text = "item 1" },
	{ type = "item", text = "item 2" },
	{ type = "item", text = "item 3" }
};

server.update({ id = "list", ontap = "mydialog", children = items });

actions.mydialog = function(i)
        -- if (i == 0) then item 1 ...
end

Message Dialog

server.update({ 
	type = "dialog", 
	text = "Hello World!", 
	ontap = "mydialog",
	children = {
		{ type = "button", text = "Foo" },
		{ type = "button", text = "Bar" }
	}
});

actions.mydialog = function(i)
        -- if (i == 0) then Foo! ...
end

Input Dialog

server.update({
	id = "myinputdialog",
	type = "input",
	title = "Write something!", 
	ontap = "myinputdialog_done"
});

actions.myinputdialog_done = function(txt)
        if (is_valid(txt)) then 
		fancy_stuff(txt) ...
	end
end