Skip to content

Instantly share code, notes, and snippets.

@Asmageddon
Created July 24, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asmageddon/553a96c36438ddc915e44ffaf952b594 to your computer and use it in GitHub Desktop.
Save Asmageddon/553a96c36438ddc915e44ffaf952b594 to your computer and use it in GitHub Desktop.
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