I'm developing a GUI and I have a problem when I try to pass a filename as a parameter.
I wrote my function like this:
Code: Select all
GUI.addCheckbox(px,py,pw,ph,pcolor,pborderSize,pborderColor,pshape,ptext,pfont,ptextsize)
local cb ={}
....
cb.text = {}
cb.text.font = love.graphics.newFont(pfont, ptextsize)
Code: Select all
...
MyGUI.addCheckbox(10 + elements[j].x + i*40, elements[j].y + 10,30,40,colWHITE,2,colBLACK,"roundrect", i+2, "font/arl.ttf", 24)
Code: Select all
Error: bad argument #1 to '?' (filename, File, or FileData expected)
stack traceback:
[love "boot.lua"]:345: in function <[love "boot.lua"]:341>
[C]: at 0x7ff9b1d52630
[C]: in function 'newFont'
GUI.lua:39: in function 'addCheckbox'
main.lua:21: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[love "boot.lua"]:361: in function <[love "boot.lua"]:348>
[C]: in function 'xpcall'
Process exited with code 1
Code: Select all
cb.text.font = love.graphics.newFont("font/arl.ttf", ptextsize)
Of course I can not put my text in hard.