Gspöt - retained GUI lib

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
pgimeno
Party member
Posts: 1909
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: Gspöt - retained GUI lib

Post by pgimeno » Wed Nov 20, 2019 4:44 pm

Code: Select all

button.label = tostring(number)

User avatar
zenith
Prole
Posts: 13
Joined: Sat Oct 12, 2013 5:44 pm

Re: Gspöt - retained GUI lib

Post by zenith » Thu Nov 21, 2019 5:52 am

I mean, how to update text string on separate gui:text element on button click?
ping pong

User avatar
pgimeno
Party member
Posts: 1909
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: Gspöt - retained GUI lib

Post by pgimeno » Thu Nov 21, 2019 12:03 pm

Ah, well, same idea, just set the label of the gui:text element.

Code: Select all

function love.load()
	number=0
	text=gui:text(tostring(number))
	
	button=gui:button('Click me')
	function button.click(this,x,y)
		number=number+1
                text.label = tostring(number)
	end
end

User avatar
zenith
Prole
Posts: 13
Joined: Sat Oct 12, 2013 5:44 pm

Re: Gspöt - retained GUI lib

Post by zenith » Thu Nov 21, 2019 3:23 pm

thank you!
ping pong

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests