Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shell
- function setShell(s)
- shell=s
- _G.require.setShell=nil
- end
- function require(path)
- if _G[path]~=nil then return end -- stuff
- local modulePath=shell.resolve(".")
- for part in string.gmatch(path,"[^%.]+") do
- local can = modulePath.."/"..part
- if fs.exists(can) then
- modulePath=can
- elseif fs.exists(can..".lua") then
- modulePath=can..".lua"
- end
- end
- if modulePath == shell.resolve(".") then
- return nil
- else
- return loadfile(modulePath)()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment