I'm trying to make a little GUI API.
So, I have a function to "start" the gui.
(Starts an infinite loop to catch mouse events)
Here's the function:
function startMenu()
while true do
local sEvent, sButton, sX, sY = os.pullEvent("mouse_click")
for i = 1, #buttons do --buttos is a table which contains the button coords
if sX >= buttons[i][1] and sX <= buttons[i][2] and sY >= buttons[i][3] and sY <= buttons[i][4] then
buttonFunctions[i] --this is a table which contains the functions that runs if a button is clicked
end
end
end
end
whats wrong with the code?












