Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
rawrequire = require
function require(path)
if string.sub(path, 1,1) == "." then
local root = (debug.getinfo(2, 'S')).source:sub(2);
root = root:gsub("/[^/]*$", ""):gsub("/", ".")
return rawrequire(root .. path)
else
return rawrequire(path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment