So i'm attempting to use loveframes to make a button, however no matter what I do, if there is a button on the screen and I have loaded an image in, whenever I hover over the button the window just closes. I use ZeroBrane Studio and the console from there gives me this error after the crash:
Error: libraries/loveframes/objects/base.lua:790: attempt to call field 'insert' (a nil value)
stack traceback:
libraries/loveframes/objects/base.lua:790: in function 'CheckHover'
libraries/loveframes/objects/button.lua:49: in function 'update'
libraries/loveframes/objects/base.lua:45: in function 'update'
libraries/loveframes/init.lua:204: in function 'update'
main.lua:11: in function 'update'
[string "boot.lua"]:434: in function <[string "boot.lua"]:399>
[C]: in function 'xpcall'
Program completed in 1.25 seconds (pid: 4540).
I have no idea what i'm doing wrong, but it seems that the button only works if I don't load an image anywhere in my code. This also happens with every other object from loveframes.
I tried it out and it opened up and then crashed, then i went into the main.lua file and changed table to tables on both lines 5 & 16 after that it ran without error.
Other than that there is no code to do anything else, those errors might be from you using a different version of love because i didn't get any of those errors listed.
That line of code replaces Lua's built-in table library with your image. Love Frames needs the table library to function correctly, so you should replace that line with something like:
That line of code replaces Lua's built-in table library with your image. Love Frames needs the table library to function correctly, so you should replace that line with something like:
Another fix would be to make the variable local by adding "local table" at the top of the file. This will tell Lua that you are referring to a variable that exists only in that file, and that it's a different one from Lua's built-in "table".
Of course, this will cause conflicts if you want to use Lua's table library in that file. Personally I'd suggest both changing the variable name and making it local, as keeping variables local where possible is considered good practice.