function make_button(options) local state = 0 -- 0 = normal, 1 = hovered, 2 = pressed local w = print(options.text, 0, -100) return { x = options.x, y = options.y, w = options.w or w, h = options.h or 6, data = options.data, text = options.text, on_click = options.on_click, on_hover = options.on_hover, ogColor = options.color or 5, color = options.color or 5, draw=function(self, selected) standard_font() local color = selected and 7 or self.color print(self.text, self.x+1, self.y+1, color) end, update=function(self) self.color = self.ogColor if mouse_x >= self.x and mouse_x <= self.x + self.w and mouse_y >= self.y and mouse_y <= self.y + self.h then if stat(34)&1 == 0 and state == 2 and self.on_click then self.on_click(self) end if stat(34)&1 == 1 then state = 2 else if self.on_hover then self.on_hover(self) end state = 1 end else state = 0 end end } end