Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local width, height = minetest.get_screen_size();
- local player = minetest.get_local_player();
- -- ^ this is client-side script
- -- for server-side (single player), we might do minetest.get_sp_player()
- local formspec = FormSpec()
- formspec.width = width / 2
- formspec.height = height / 2
- local button = Button()
- button.text = "OK"
- button.width = 75
- button.height = 25
- button.x = (width - formspec.width) / 2
- button.y = (height - formspec.height) / 2
- button.onclick = function(target, params)
- -- target - ref to button which was clicked (because the same callback can be
- bound to multiple buttons)
- -- params - additional mouse/keyboard parameters
- target.parentForm:close()
- end
- formspec:addControl(button);
- formspec:showTo(player); -- or maybe player:showForm(formspec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement