Reloading Files during Runtime

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Reloading Files during Runtime

Post by raidho36 »

Oh, that. I didn't knew about this feature particularry.

I looked it up. You can remove the module from cache using this syntax:

Code: Select all

package.loaded.myModule = nil
Then, re-requiring it again actually reloads it.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Reloading Files during Runtime

Post by Plu »

That sounds like a good trick, then.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Reloading Files during Runtime

Post by Robin »

I recommend using love.filesystem.load over require and resetting its package.loaded field each time beforehand, otherwise you might end up confusing yourself.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests