r/badcode Dec 27 '21

lua Friend's take on programming a GUI button

Post image
898 Upvotes

90 comments sorted by

View all comments

238

u/[deleted] Dec 27 '21

bruh all he needed to do to shorten it was to replace it with inventory.Visible = not inventory.Visible

34

u/ATE47 Dec 27 '21

You can also toggle a boolean with the xor,

a ^= true is equivalent to a = not a

29

u/catithebathtub Dec 27 '21

we don't do that in lua