Update physics World in another Thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
AntonioModer
Party member
Posts: 202
Joined: Fri Jun 15, 2012 5:31 pm
Location: Belarus
Contact:

Re: Update physics World in another Thread

Post by AntonioModer » Thu Jan 12, 2017 10:21 pm

I found the main critical problem.
Functions in http://www.love2d.org/wiki/World:setCallbacks works only in one thread and they cant pass to another.
Same for http://www.love2d.org/wiki/Fixture:setUserData and http://www.love2d.org/wiki/Body:setUserData if userData is table or function (pointer).

User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Update physics World in another Thread

Post by raidho36 » Thu Jan 12, 2017 10:30 pm

Well yeah - LÖVE threads are not real threads, because Lua doesn't support threads. They sort of are threads, but you need to keep in mind that they're implemented via separate Lua states running in separate threads. You can't pass a table (or anything really) from one Lua state to another, you can only do a full duplicate (so it won't be the same object, just a snapshot clone of it), which isn't even always possible.

Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests