Skip to content

Instantly share code, notes, and snippets.

@ptrv
Last active August 29, 2015 14:05
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 ptrv/166767e889f5a6085b94 to your computer and use it in GitHub Desktop.
Save ptrv/166767e889f5a6085b94 to your computer and use it in GitHub Desktop.
local lua_require = require
function require(mod_name)
if package.preload[mod_name] == nil then
package.preload[mod_name] = function()
local filename = of.toDataPath("scripts/"..mod_name..".lua", true)
local fn = loadfile(filename)
return fn()
end
end
lua_require(mod_name)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment