[SOLVED] require fails when used in thread
Posted: Tue Apr 21, 2015 7:16 pm
Hey all. Got a threading-related issue here that's not race conditions!
Long story short, I need to include (require) a file in a thread. Whenever I try this, the thread throws an error saying it can't find the file, even though it is required in the exact same way in other files (that run in the main thread).
Below is a very bare-bones example you can use to recreate the problem. (This example is also attached as a .love file.)
/main.lua:
/thread.lua
/something.lua
Can be empty, as long as the file actually exists.
Is this known behavior? Am I overlooking something? Is there anything I can do to fix this?
Thanks for your help!
Long story short, I need to include (require) a file in a thread. Whenever I try this, the thread throws an error saying it can't find the file, even though it is required in the exact same way in other files (that run in the main thread).
Below is a very bare-bones example you can use to recreate the problem. (This example is also attached as a .love file.)
/main.lua:
Code: Select all
require "something" -- This works fine.
function love.load()
thread = love.thread.newThread("thread.lua")
thread:start()
end
function love.threaderror(thread, err)
error("Thread error!\n" .. err)
end
Code: Select all
require "something" -- This throws a "Module 'something' not found" error.
Can be empty, as long as the file actually exists.
Is this known behavior? Am I overlooking something? Is there anything I can do to fix this?
Thanks for your help!