Skip to content
RR is a module that simplifies and automates the requiring process of lua or Love2D
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

RR is a module for automating requiring modules/libs for Love2D and Lua.

Useful if you have so many individial lua files that you want to require.

Love2D Forums Thread Link

WARNING: Remove all other .lua files in the directory you will require except the actual modules. Why? It makes issues.


  • Instead of doing something like this:
module1 = require("module1")
module2 = require("module2")

state1 = require("state1")
state2 = require("state2")

player = require("player")
ground = require("ground")
  • DO THIS!
RR = require("path-to-rr")

You can also refer to the sample

  • Assuming that all you want to load is in the "modules" folder. You can change it through:
RR.setDir("name-of-custom-foler") --before RR.start()
  • You can use or refer to a module name based on its file name. So if you have a module called "classic":
  • Besides the default folder, you can also add more folders using:
RR.addDir("modules") --"modules" is the default folder


  • RR.getDir() - returns the string of the module directory name, default is "modules"

  • RR.setDir(newDir) - change the module directory name,

  • RR.start() - start the automated requiring process.

  • RR.get(name) - returns the table(the module)

  • RR.addDir(folderName) - add another directory to recursively require.

  • RR.list() - prints all required modules. Useful along with LOVEDEBUG.

You can also use this library not only for actual modules, but for other .lua files, like player objects, etc.

NOTE: if the module does not return its file, calling the module via RR.get("something") will return to "true". Compare "classic" module with "lovedebug".

Basically, a module that returns it "file" or "content" is like this:

local MY_MODULE = {}



--etc etc

return MY_MODULE

While there are also this kind of module:

function MY_MODULE_name()


function MY_MODULE_type()


And so on, you get the idea. Personally, I prefer the use of the first kind of module-making thingy.

NOTE: Don't use RR.get("module-name") in a lua file that WILL ALSO BE REQUIRED. Just do a regular require there.

You can’t perform that action at this time.