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
How do i fix this syntax error i have?
Re: How do i fix this syntax error i have?
So, you give us code snippet with 24 lines, but error happens on line 63?
Do you provided full source or what?
Do you provided full source or what?
Re: How do i fix this syntax error i have?
You're missing a comma to separate the arguments at the end of this line:
The error happens because Lua doesn't know if the following is what you actually meant (if we append the next line):
(Also, this is specifically a Lua error, not a LÖVE related error, just to be clear.)
Code: Select all
(ww * 0.75) - (b_width * 0.85)
Code: Select all
(ww * 0.75) - (b_width * 0.85)(wh * 0.6) - (b_height * 0.5))
-- This looks like a call: (whatever)(wh * 0.6)
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: How do i fix this syntax error i have?
Also for better readibility, you can put your code to [code] [/code] tags in the forums
Re: How do i fix this syntax error i have?
edit: oops, missed the replies
Who is online
Users browsing this forum: slime and 8 guests