I need to use love.thread to run another process, which is basically a copy of the world of the game. I'm using STI and Bump. But since the Lua process that love.threads runs has little to no features, I have to require the love modules I need, and had to supply the love.run function. All good so far. However, STI fails when loading a map giving me this error:
Cannot create canvas: May not be supported by your OpenGL drivers.
My computer definitively supports canvases, since they work fine on the normal process, but they fail on a threaded process. Am I forgetting to supply something to the threaded .lua file?
Sorry for the double post, but i'm still confused. I still cannot get the threaded process to work like a somewhat normal Love2D game. I get errors with love.handlers, and many of the obvious solutions didn't work. Copying love.createHandlers() and executing it made it go crazy, and executing boot.lua and love.init() previous to everything gets me a bunch of errors about "arg" being nil.
How can I make the threaded process work like a normal Love2D game?
New threads are in a separate memory space from the main thread. Any events you want to spawn will need to be sent through a Channel. A Channel is the only way to communicate between threads.
Tanner wrote:New threads are in a separate memory space from the main thread. Any events you want to spawn will need to be sent through a Channel. A Channel is the only way to communicate between threads.
That's not what I need, the problem is that threaded .lua files act like plain .lua files and I need them to work like Love2D games
Tanner wrote:New threads are in a separate memory space from the main thread. Any events you want to spawn will need to be sent through a Channel. A Channel is the only way to communicate between threads.
That's not what I need, the problem is that threaded .lua files act like plain .lua files and I need them to work like Love2D games
Thats what he's saying, you can't . Any real interaction with the core löve api needs to happen in the main process. Also you need to require the different love modules by yourself in other threads.
Substance12 wrote:I get errors with love.handlers, and many of the obvious solutions didn't work. Copying love.createHandlers() and executing it made it go crazy, and executing boot.lua and love.init() previous to everything gets me a bunch of errors about "arg" being nil.
As s-ol said above me, you don't need to do any of that, just require 'love.<something>" where something is a löve module name like 'filesystem', but as slime said, 'window' and 'graphics' will probably not work... or at least, most of the functions won't; i haven't tested whether some would.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.