Ok, I try:
drawDisplayBox(posx,posy,width,height,a())
if X > posx and X < posx+width and Y > posy and Y < posy+height then
if clicked and clickedFrames > 0 then
a()
end
boxSelected(posx,posy,posx+width,posy+height)
else
boxNormal(posx,posy,posx+width,posy+height)
end
end
----------------------------------------------------------------------
local drawPosition = function()
width=106
height=35
drawDisplayBox(PositionX,PositionY,width,height,a()
-- this happens when clicking on the display:
menuscreen=0 -- menu gets closed
PositionY = PositionY + (Y-YBefore) -- enables dragging the display around
PositionX = PositionX + (X-XBefore) -- "
end
)
(...)
end
drawDisplayBox() is the new function I'm using.
PositionX, PositionY, X, Y, XBefore, YBefore, clicked and clickedFrames are all global variables so I'm not passing such as parameters.
It doesn't matter if using function() or a(), I'm still getting an error:
LuaInterface.LuaScriptException: [string "main"]:564: '<eof>' expected near 'end'
564 is the line where the very last "end" of drawDisplayBox() is.
Thanks everyone for helping me so far.