How do i fix this syntax error i have?
Posted: Thu Sep 01, 2022 10:27 pm
I am trying to make a clicks per second test application and im having a syntax error with my code so could anyone help me??
function love.load()
local buttons = {}
local texts = {}
table.insert(buttons, newButton(
"Click Me!",
function()
print("Button.... Yes...")
end))
end --- Loads in the button so it can be drawn
function love.draw()
width = 140
height = 64
local ww = love.graphics.getWidth()
local wh = love.graphics.getHeight()
b_width = ww - (1/3)
b_height = 200
love.graphics.rectangle(
"fill",
(ww * 0.75) - (b_width * 0.85)
(wh * 0.6) - (b_height * 0.5))
end
end --- Draws the button
The error is
Syntax error: main.lua:62: ambiguous syntax (function call x new statement) near '('
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x7ffa46de31d0
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
also just to know im new to love2d so i still dont really understand the code too much
function love.load()
local buttons = {}
local texts = {}
table.insert(buttons, newButton(
"Click Me!",
function()
print("Button.... Yes...")
end))
end --- Loads in the button so it can be drawn
function love.draw()
width = 140
height = 64
local ww = love.graphics.getWidth()
local wh = love.graphics.getHeight()
b_width = ww - (1/3)
b_height = 200
love.graphics.rectangle(
"fill",
(ww * 0.75) - (b_width * 0.85)
(wh * 0.6) - (b_height * 0.5))
end
end --- Draws the button
The error is
Syntax error: main.lua:62: ambiguous syntax (function call x new statement) near '('
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x7ffa46de31d0
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
also just to know im new to love2d so i still dont really understand the code too much