I was trying threads for the first time, and it appears that love.timer in threads is a nil value, because I get the "attempted to index a nil value" error message whenever I access it.
This means I do not have access to love.timer.sleep for any delays in code execution. Is there another way to do these sorts of delays in threads?
I am aware that I could the "demand" method of channels that are communicating with the main thread, and so have the main thread do all of the sleeping for the other threads, but that would be difficult to set up. I do not want to do this if there is an easier way.
[Solved] sleep in threads
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved] sleep in threads
Last edited by SirDust on Fri Aug 11, 2017 12:29 am, edited 1 time in total.
Re: sleep in threads
(Also If I am correct that love.timer in threads is a nil value, perhaps that info should be added to the love wiki, especially since the wiki already states what other modules are restricted)
Re: sleep in threads
AFAIK you have to import all love modules you want to use in your threads manually. So, try importing love.timer before actually using it!
https://github.com/Sulunia
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: sleep in threads
love.thread is the only module that gets loaded in a thread automatically, but Sulunia's right; everything else you'll need to require in yourself; for example:
Code: Select all
require 'love.sound'
require 'love.audio'
Also from the relevant wiki page: "When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require." right above the first yellow notice box.
By the way, only love.graphics and love.window is really restricted; everything else should (more-or-less) work.
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.
Re: sleep in threads
whoops did not see that. Ok that makes sense, thanks!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest