The love file I have here produces a syntax error. I do not know what it wants me to do to solve it, and therefore I'm asking for help now. The main menu is image-based, featuring a few buttons and a background texture. The love file features code that is supposed to make the buttons glow when the mouse is hovering over them, which is what is problematic. If I comment out all the code for drawing the buttons, the script runs and the background texture renders along with the cursor. That stuff works. The only thing that is scripted for at this point is the main menu. The image folder in the love also contains some relics that are not used.
The error I get is:
syntax error: menu.lua:60 ')' expected near main_menu_buttons
What follows is the functions dealing with said table to give some context:
Code: Select all
function main_menu_buttons_load(number, width, height)
local CentralX = find_central_x()
local HalfWidth = width/2
for var = 1, number, 1 do
local var2 = var - 1
main_menu_buttons[var].X = CentralX - HalfWidth
main_menu_buttons[var].Y = 128 + var2 * 128
main_menu_buttons[var].RelaxedImage = love.graphics.newImage("images/mainmenubutton"..var..".png")
main_menu_buttons[var].HoverImage = love.graphics.newImage("images/mainmenubutton"..var.."hover.png")
main_menu_buttons[var].Width = width
main_menu_buttons[var].Height = height
main_menu_buttons[var].Hover = false
end
end
Code: Select all
function main_menu_buttons_update(number)
local MouseX = love.mouse.getX()
local MouseY = love.mouse.getY()
local var = 1
for var = 1, number, 1 do
if MouseX > main_menu_buttons[var].X
and MouseX < main_menu_buttons[var].X + main_menu_buttons[var].Width
and MouseY > main_menu_buttons[var].Y
and MouseY < main_menu_buttons[var].Y + main_menu_buttons[var].Height
then
main_menu_buttons[var].Hover = true
else
main_menu_buttons[var].Hover = false
end
end
end
Code: Select all
function main_menu_buttons_draw(number)
local var = 1
for var = 1, number, 1 do
if main_menu_buttons[var].Hover == true then
love.graphics.draw(main_menu_buttons[var].HoverImage, main_menu_buttons[var].X main_menu_buttons[var].Y)
else
love.graphics.draw(main_menu_buttons[var].RelaxedImage, main_menu_buttons[var].X main_menu_buttons[var].Y)
end
end
end